Ok, so I recently got into using VSCode for a Unity3D C# scripting project. I really like it.
So, I'm trying to get it set up for python scripting in FreeCAD just to do general development. A minor housekeeping issue has arose, though. VSCode / pylint can't find the FreeCAD modules I regularly import (FreeCAD, FreeCADGui, Part, etc.) It's a minor issue since I'm not running the code from VSCode, but I've made a few attempts at resolving it with no luck.
Any thoughts?
VSCode / Pylint question
- Joel_graff
- Veteran
- Posts: 1949
- Joined: Fri Apr 28, 2017 4:23 pm
- Contact:
VSCode / Pylint question
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails
pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
Re: VSCode / Pylint question
I assume you use Linux (Ubuntu)? One way is to add (locate FreeCAD.so):Joel_graff wrote: ↑Sun Jan 21, 2018 11:56 am It's a minor issue since I'm not running the code from VSCode, but I've made a few attempts at resolving it with no luck.
Any thoughts?
Code: Select all
init-hook='import sys; sys.path.append("/usr/lib/freecad/lib")'
https://github.com/Microsoft/vscode-python/issues/179
- Joel_graff
- Veteran
- Posts: 1949
- Joined: Fri Apr 28, 2017 4:23 pm
- Contact:
Re: VSCode / Pylint question
Worked like a charm! Thanks!
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails
pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
Re: VSCode / Pylint question
Good to hear that and you're welcome.
Re: VSCode / Pylint question
Where can we document this on the wiki? (It just may be already but I didn't see it?)
Specifically, a page to help people set up vscode for FreeCAD development
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Re: VSCode / Pylint question
I also need help with that!Kunda1 wrote: ↑Fri Sep 20, 2019 7:10 pmWhere can we document this on the wiki? (It just may be already but I didn't see it?)
Specifically, a page to help people set up vscode for FreeCAD development
Re: VSCode / Pylint question
.pylintrc does not seem to located in my home directory.
To add it, I changed to my project folder:
~/.FreeCAD/Mods/workbench/.pylintrc
I had to generate the .pylintrc using:
pylintrc --generate-rcfile > .pylintrc
In the .initrc, I found an init-hook section
To add it, I changed to my project folder:
~/.FreeCAD/Mods/workbench/.pylintrc
I had to generate the .pylintrc using:
pylintrc --generate-rcfile > .pylintrc
In the .initrc, I found an init-hook section
Code: Select all
[MASTER]
...
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
init-hook='import sys; sys.path.append("/usr/lib/freecad/lib")'
3D Printing, CAD, Electronics and other errata at: https://www.youtube.com/channel/mathcodeprint