justinfx / MayaSublime

Send selected Python and MEL code snippets from SublimeText to Maya via commandPort
MIT License
149 stars 38 forks source link

Making edits to the python script causes MayaSublime to stop sending commands to Maya #34

Closed CatsNipYummy closed 5 years ago

CatsNipYummy commented 6 years ago

I have some python script that it includes some native python commands and also maya python commands in it. MayaSublime works fine when I run it. But once I make edits to the python file, I get the following warning after which MayaSublime stops working. I have to restart Maya to get it working again.

Version - Maya 2017

# C:\Program Files\Autodesk\Maya2017\Python\lib\site-packages\maya\app\general\CommandPort.py:1: RuntimeWarning: Parent module 'maya.app.general' not found while handling absolute import

justinfx commented 6 years ago

That looks like whatever your code is doing is crashing the Maya commandPort thread. So it is no longer accepting remote connections. Do you have an exact snippet that causes this to happen? MayaSublime doesn't really manage the commandPort; it just expects it to exist. If it crashes, the only way we could fix it is to install a handler on the maya side that would act like a watchdog and try to reopen the commandPort.

When it crashes, does something like this succeed in opening it again?

cmds.commandPort(name=":7002", sourceType="python")
CatsNipYummy commented 6 years ago

Makes sense. But it does this weird thing where-in, whatever simple snippets I run from the Maya code editor stops working. A simple print 1 statement doesn't output anything. The only thing I can do is restart. I have some threading code in my classes. There's a chance that might be breaking the commandPort.

justinfx commented 6 years ago

Just so I understand correctly, you are saying that any bit of code that runs from the Maya Script Editor dialog window stops working? MayaSublime does add a callback to capture script editor output and send it through a socket to Sublime. But this is completely outside the commandPort.

justinfx commented 5 years ago

Closing with no activity