MeTheMachine Posted April 16, 2018 Share Posted April 16, 2018 I'm trying to use Pycharm to debug scripts, but I'm having trouble getting Pycharm and Vectorworks to communicate. My suspicion is that I'm not setting the correct python path in VW, under Tools>Plugins>Plugin Options. I have created a new project in PyCharm called "Vectorworks Debug" in /Dropbox/PythonProjects/PycharmProjects/Vectorworks Debugging. I've set up my environment paths like so: I've added the Python Sample Menu Command and uncommented out the lines, import pydevd and the settrace. import vs import ui.dlgHandler def execute(): # import pydevd # pydevd.settrace('localhost', port=1090, stdoutToServer=True, stderrToServer=True) data = ui.dlgHandler.DialogData() data.operationValue = "value" data.operationValue1 = 11 if ui.dlgHandler.RunDialog(data): # ok updates the 'data' from the local dialog data data = ui.dlgHandler.dialogData vs.AlrtDialog("The dialog was confirmed. The value is: ", data.operationValue) else: # cancel keeps the 'data' unchanged vs.AlrtDialog("The dialog was CANCELED. The value is: ", data.operationValue) When I run the Sample Menu Command, I'm getting an import library error No module named pydev Importing sys and print(sys.path) in a VW scripts gives me the following paths. /Users/me/Dropbox/Vectorworks/User Folders/Plug-ins/Marionette/ /Users/me/Dropbox/PythonProjects/PycharmProjects/Vectorworks Debugging/ /Applications/Vectorworks 2018/Vectorworks 2018.app/Contents/Frameworks/Python.framework/Versions/3.5/lib/python3.5 /Applications/Vectorworks 2018/Vectorworks 2018.app/Contents/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages /Applications/Vectorworks 2018/Vectorworks 2018.app/Contents/Frameworks/Python.framework/Versions/3.5/../../../../../../Libraries/PythonExternals /Applications/Vectorworks 2018/Vectorworks 2018.app/Contents/Frameworks/Python.framework/Versions/3.5/lib/python3.5/lib-dynload /Applications/Vectorworks 2018/Plug-ins/ /Users/me/Dropbox/Vectorworks/User Folders/Plug-ins/ /Users/me/Dropbox/PythonProjects/PycharmProjects/Vectorworks Debugging/ /Users/me/Dropbox/Vectorworks/User Folders/Plug-ins/Marionette/ I've tried also adding '/Users/me/Dropbox/PythonProjects/PycharmProjects/Vectorworks Debugging/venv' to VW paths but with no success. Any suggestions would be helpful and appreciated it. Thank you. --- Eventhough I haven't gotten past my import error, here is how I've set up Pycharm remote debug. If anyone sees anything wrong, let me know. Quote Link to comment
MeTheMachine Posted April 17, 2018 Author Share Posted April 17, 2018 So I got this working... Thought I would share my steps. First, I created a folder called "Python Modules" and set it as a path in VW script options. I downloaded and copied Pydevd to the Python Modules Folder. Per, PyCharm instructions, I got the "pycharm-debug-py3k.egg" and copied it to the modules file, also. I created a PycharmDebug.py file that imports sys and appends the egg file to the path. In the script I want to debug, I add the following: import PycharmDebug import pydevd pydevd.settrace('localhost', port=1090, stdoutToServer=True, stderrToServer=True) With that in mind, I'm almost certain I made some unnecessary/extra steps. Any suggestions or thoughts would be helpful. 2 Quote Link to comment
drfoulk@gmail.com Posted April 11, 2021 Share Posted April 11, 2021 Unbelievably helpful. That is a lot of heavy lifting to sort out the directory nuances. Thank you! I was just preparing to try and use PyCharm for debugging after tearing my hair out on a script. This prevented tearing my hair out on - the debugging! Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.