Jump to content

Pycharm Debugging

Recommended Posts

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)

        # 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. 






Link to comment

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.




Link to comment
  • 2 years later...

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.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...