justinfx / MayaSublime

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

MayaSublime.py - Error: namespace = __main__.__dict__.get('_sublime_SendToMaya_plugin') #13

Closed hmcmurray closed 11 years ago

hmcmurray commented 11 years ago

Here's the output in the Maya session:

image

Line 4 is an import most likely NOT related to the problem - I'm guessing.

Here's what I'm running in Sublime that produces the error:

image

Maybe I'm just missing something and I'm wasting your time. Apologies if that's the case.

Hez

justinfx commented 11 years ago

Did you forget to set the sourceType Param of the commandPort to "python"? The default is MEL so you are sending Python syntax to a Mel port.

Try deleting and creating it again http://download.autodesk.com/us/maya/2011help/CommandsPython/commandPort.html

hmcmurray commented 11 years ago

Yep,

Pretty embarrassing.

Thanks. H

justinfx commented 11 years ago

No worries. Thanks for checking out the plugin!

hmcmurray commented 11 years ago

I'm definitely happy with it! Helps A LOT!

Thanks! Hez

On Sat, Aug 24, 2013 at 3:49 PM, Justin Israel notifications@github.comwrote:

No worries. Thanks for checking out the plugin!

— Reply to this email directly or view it on GitHubhttps://github.com/justinfx/MayaSublime/issues/13#issuecomment-23218094 .

Hezekiah McMurray hez.mcmurray@gmail.com

kurtontheway commented 10 years ago

Why not treat all the scripts as mel, and then when it comes as python, use the mel command "python" to exec it.

justinfx commented 10 years ago

@kurtontheway I haven't really tried to make that approach work with much effort, but I think it requires more complicated escaping of the python code that gets executed through the mel python() command. The approach I am using now ensures that the python code that is executing is using a persistent namespace that isn't the main namespace.