justinfx / MayaSublime

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

Can not get output in sublime to work #29

Open vicro opened 7 years ago

vicro commented 7 years ago

I get the following error in Maya's script editor

# Traceback (most recent call last):
#   File "<string>", line 17, in <module>
#   File "<string>", line 1, in <module>
#   File "<string>", line 25, in _MayaSublime_streamScriptEditor
# NameError: global name 'sys' is not defined

I noticed you did a commit where you added import sys to pubScriptEditor.py. Installed latest version but I still get the error. Any ideas? Im using Maya2016 Extension 2

justinfx commented 7 years ago

It usually takes at most a day for the changes to sync up with the Sublime Package Control system and then be delivered back to those that are using automatic updates. Are you using it through Package Control and has it updated to 3.0.2? Have you checked your package location to confirm the code has been updated to the latest version?

vicro commented 7 years ago

I just tryed removing the package, and installing again from Package control, Opened the code and it has the sys import. Still getting the error. Python is different version, Is Maya Python different from installed python? some env_var missing?

justinfx commented 7 years ago

It seems that Sublime Package Control updated their format, possibly, and is not automatically picking up my updates. It did not pick up release 3.0.2 because it says the last release date it is using is a day before the 3.0.2 release. I've submitted a pull to update the settings.

https://github.com/wbond/package_control_channel/pull/6107

In the meantime, you could also manually clone MayaSublime to your package location.

justinfx commented 7 years ago

Did this end up working for you?

vicro commented 7 years ago

I tried with the latest source from here.

Now I'm getting this error in Maya's script editor

# Traceback (most recent call last):
#   File "<string>", line 19, in <module>
#   File "<string>", line 1, in <module>
# NameError: name '_MayaSublime_streamScriptEditor' is not defined

sys error is gone but still not working. :(

justinfx commented 7 years ago

I've just tested this, with a fresh install from Package Control, using Maya 2016 ext2, and it works as expected. Can you try making sure you have removed all traces of MayaSublime, and then install it fresh from Package Control? You may want to make sure you have cleared your user prefs in case that is causing a problem.

kurtontheway commented 7 years ago

@justinfx ,I'm using the latest version, and I can get "receive_maya_output" work only if I set "no_collisions" to true. Otherwise, I get the same error "# NameError: name '_MayaSublime_streamScriptEditor' is not defined".

justinfx commented 7 years ago

@kurtontheway , I was able to reproduce this as you said, by enabling "receive_maya_output" and disabling "no_collisions". The problem was that the callback was only ever being installed into the private python namespace. I've pushed fixes to install it to the appropriate namespace (global or private) based on the settings.

Can you confirm the master branch works for you? If so, I can tag it as 3.0.3 to it releases to package control

justinfx commented 7 years ago

Tagged as release 3.0.4: https://github.com/justinfx/MayaSublime/releases/tag/3.0.4

kurtontheway commented 7 years ago

@justinfx , Sorry for the late response and thank you for the quick fix, but I was unable to receive any maya output in sublime console by enabling "receive_maya_output" and disabling "no_collisions", no error messages as well.

justinfx commented 7 years ago

Even after restarting Maya./Sublime? I at first saw the same issue because the old code was still loaded in Maya. But then I was seeing output in the Sublime console.

kurtontheway commented 7 years ago

After restarting both Maya and Sublime.

justinfx commented 7 years ago

Sorry, I have been really busy but I will find time to look at it again. It must have something to do with the two namespaces causing headaches