justinfx / MayaSublime

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

Can't get it to go with 2014 #20

Closed boredstiff closed 10 years ago

boredstiff commented 10 years ago

I can successfully get it to work with 2013, but with 2014, I'm always getting the message "Failed to communicate with Maya(127.0.0.1:7002)):[Errno 10061] No connection could be made because the target machine actively refused it"

I already changed the config file to go to the 2014 path instead of the 2013, but it's not communicating with 2014 correctly. Any clues?

justinfx commented 10 years ago

Are you sure you have properly opened a command port on 7002 using the python sourceType? I see no reason for it to work any differently on Maya 2014.

Try deleting an existing port (if you have one) and recreating it:

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

Yeah, I saw that on the documentation earlier and gave it a shot, but the error it returned was

# Error: Command port ':7002' does not exist.
# Traceback (most recent call last):
#   File "<maya console>", line 2, in <module>
# RuntimeError: Command port ':7002' does not exist. # 

Whenever Maya is started up, I get the message commandPort -securityWarning -name commandportDefault; // Error: line 1: Could not open command port commandportDefault because that name is in use. // I feel like these are the two things that's preventing it from working with 2014 for me- never had a problem working with 2013 for the last year, SublimeMaya has been phenomenal.

justinfx commented 10 years ago

Yea so that first command is expected to fail if you never had the command port open in the first place, which would be causing your connection problem. Then you should be able to succeed on the second command to actually create the connection. I just put that second command in my userSetup.py so that it opens automatically at Maya startup.

boredstiff commented 10 years ago

Thanks for the help - I ended up getting it to work, but it ultimately came down to some Python weirdness. I got it to work through MEL with the suggestion of a friend, so the code we used was

commandPort -n ":7002" -q "true"

commandPort -n ":7002" -stp "python"

Don't know why it wouldn't work with Python, but doing it through MEL fixed it. Maybe it's a Maya 2014 bug!