justinfx / MayaSublime

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

error maya 2014 #22

Closed JokerMartini closed 10 years ago

JokerMartini commented 10 years ago

I keep receiving this error when trying to run it for maya 2014 on windows.


Failed to communicate with Maya (127.0.0.1:7002)): [WinError 10061] No connection could be made because the target machine actively refused it

justinfx commented 10 years ago

Can you verify that you can telnet into your Maya's commandPort, from outside of Sublime? It may not specifically be related to MayaSublime.

On Tue, Apr 8, 2014 at 8:23 AM, John Martini notifications@github.comwrote:

I keep receiving this error when trying to run it for maya 2014 on windows.

Failed to communicate with Maya (127.0.0.1:7002)): [WinError 10061] No connection could be made because the target machine actively refused it

Reply to this email directly or view it on GitHubhttps://github.com/justinfx/MayaSublime/issues/22 .

JokerMartini commented 10 years ago

How can I test that exactly?

On Mon, Apr 7, 2014 at 2:11 PM, Justin Israel notifications@github.comwrote:

Can you verify that you can telnet into your Maya's commandPort, from outside of Sublime? It may not specifically be related to MayaSublime.

On Tue, Apr 8, 2014 at 8:23 AM, John Martini <notifications@github.com

wrote:

I keep receiving this error when trying to run it for maya 2014 on

windows.

Failed to communicate with Maya (127.0.0.1:7002)): [WinError 10061] No connection could be made because the target machine actively refused it

Reply to this email directly or view it on GitHub< https://github.com/justinfx/MayaSublime/issues/22> .

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

justinfx commented 10 years ago

Have you managed to confirm if you have a valid commandPort open in Maya?

Try this from the Script Editor

import maya.cmds as cmds
cmds.commandPort(name=":7002", close=True)

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

I get this as an error when running that exact code:

cmds.commandPort(name=":7002", sourceType="python")

Error: RuntimeError: file line 2: Command port ':7002'

does not exist. #

On Wed, Apr 9, 2014 at 12:38 PM, Justin Israel notifications@github.comwrote:

Have you managed to confirm if you have a valid commandPort open in Maya?

Try this from the Script Editor

import maya.cmds as cmds cmds.commandPort(name=":7002", close=True)

cmds.commandPort(name=":7002", sourceType="python")

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

justinfx commented 10 years ago

That means you didn't open a commandPort in Maya so the plugin was never able to connect. Check out the readme for the plugin. You will want to add the second line (and the import statement) to your userSetup.py so that it always opens your preferred port on launch of Maya

JokerMartini commented 10 years ago

I put ....

import maya.cmds as cmds

# if it was already open under another configuration cmds.commandPort(name=":7002", close=True)

# now open a new port cmds.commandPort(name=":7002", sourceType="python")

# or open some random MEL port (make sure you change it to this port in your config file) cmds.commandPort(name=":10000", sourceType="mel")

in the userSetup.py and I get this error upon launching of maya.

Failed to execute userSetup.py Traceback (most recent call last): File "C:/Users/HP/Documents/maya/2014-x64/scripts\userSetup.py", line 4, in cmds.commandPort(name=":7002", close=True) RuntimeError: Command port ':7002' does not exist.

On Wed, Apr 9, 2014 at 12:51 PM, Justin Israel notifications@github.comwrote:

That means you didn't open a commandPort in Maya so the plugin was never able to connect. Check out the readme for the plugin. You will want to add the second line (and the import statement) to your userSetup.py so that it always opens your preferred port on launch of Maya

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

justinfx commented 10 years ago

Correct. It can't close the port that wasn't already opened. So per our offline conversation, putting this in your userSetup.py fixed your issue:

import maya.cmds as cmds
cmds.commandPort(name=":7002", sourceType="python")
cmds.commandPort(name=":10000", sourceType="mel")