Jump to content
MeTheMachine

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:

 

5ad4dc745b120_VectorworksPythonPath.thumb.png.504b49fbba483e5fbba47d99d60dd005.png

 

 

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

 

5ad4deb1eef49_VWImportError.thumb.png.73ec08d9bbedc7292cd08162299f6740.png

 

 

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. 

 

5ad4dde0252eb_PyCharmRemoteDebug.thumb.png.fc4d168b0452c0eafccf3e97a5814be4.png

 

 

 

Share this post


Link to post

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.

 

 

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×