Open xc278260759 opened 2 years ago
HI @xc278260759
try using this command instead
commandPort -n "localhost:7001" -stp "mel";
check this thread as well for resolution https://github.com/artbycrunk/vscode-maya/issues/25
i tried above command you said. didnt help
In Maya 2023 have problem in socket port . Please check.
In Maya 2023 have problem in socket port . Please check.
How to Check that?
Did anyone ever fix this issue? I'm having the same problem in Maya 2023:
commandPort -name "localhost:7001" -sourceType "mel";
# ----------------------------------------
# Exception occurred during processing of request from ('127.0.0.1', 59185)
# Traceback (most recent call last):
# # File "F:\Program Files\Autodesk\Maya2023\Python\lib\socketserver.py", line 316, in _handle_request_noblock
self.process_request(request, client_address)
# # File "F:\Program Files\Autodesk\Maya2023\Python\lib\socketserver.py", line 347, in process_request
self.finish_request(request, client_address)
# # File "F:\Program Files\Autodesk\Maya2023\Python\lib\socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
# # File "F:\Program Files\Autodesk\Maya2023\Python\lib\socketserver.py", line 747, in __init__
self.handle()
# # File "F:\Program Files\Autodesk\Maya2023\Python\lib\site-packages\maya\app\general\CommandPort.py", line 134, in handle
self.wfile.write(self.server.commandMessageQueue.get() + self.resp_term)
# # File "F:\Program Files\Autodesk\Maya2023\Python\lib\socketserver.py", line 826, in write
self._sock.sendall(b)
# TypeError: a bytes-like object is required, not 'str'
# ----------------------------------------
I have an update on what I found after doing a little digging around in Maya's source scripts.
in the file
F:\Program Files\Autodesk\Maya2023\Python\Lib\site-packages\maya\app\general\CommandPort.py
On line 134, as an experiment I changed it
from:
self.wfile.write(self.server.commandMessageQueue.get() + self.resp_term)
to:
self.server.commandMessageQueue.get() + self.resp_term
#self.wfile.write()
effectively telling it to go ahead and execute the message in the commandMessageQueue but don't do the self.wfile.write().
And wouldn't you know it, after reloading Maya everything worked as expected.
print("hello world")
outputted to the output just fine,
and
cmds.sphere(r=1,n="hell_world_sphere")
created a nurbs sphere called hello_world_spehre as expected.
I'm not sure what you will have to do to update your extension, obviously we can't all edit our Maya source code to make this work, but hopefully this will lead you in the right direction?
you helped me better then ChatGPT :O
maya 2023 bug