artbycrunk / vscode-maya

A Visual Studio Code extension with support for coding for Maya.
MIT License
43 stars 9 forks source link

Compatibility issue with Maya 2022 #32

Open Jordandionduval opened 2 years ago

Jordandionduval commented 2 years ago

Description

There seems to be issues when running this through maya 2022. I tested with maya 2020 and it works just fine, but 2022 blocks at an error code and can't send through commands to Maya.

To Reproduce Steps to reproduce the behavior:

  1. Execute "commandPort -name "localhost:7001" -sourceType "mel" -echoOutput;" in maya's script editor
  2. Go to visual studio code
  3. Type a test code print("hello")
  4. First time around: See code output in script editor along with error code
  5. Any further attempts: Error code

Expected behavior Command output in the script editor

Result

 # TypeError: a bytes-like object is required, not 'str'
# ----------------------------------------
# ----------------------------------------
# Exception happened during processing of request from('127.0.0.1', 50484)
# Traceback (most recent call last):
# #   File "C:\Program Files\Autodesk\Maya2022\Python37\lib\socketserver.py", line 316, in _handle_request_noblock
    self.process_request(request, client_address)
# #   File "C:\Program Files\Autodesk\Maya2022\Python37\lib\socketserver.py", line 347, in process_request
    self.finish_request(request, client_address)
# #   File "C:\Program Files\Autodesk\Maya2022\Python37\lib\socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
# #   File "C:\Program Files\Autodesk\Maya2022\Python37\lib\socketserver.py", line 720, in __init__
    self.handle()
# #   File "C:\Program Files\Autodesk\Maya2022\Python37\lib\site-packages\maya\app\general\CommandPort.py", line 134, in handle
    self.wfile.write(self.server.commandMessageQueue.get() + self.resp_term)
# #   File "C:\Program Files\Autodesk\Maya2022\Python37\lib\socketserver.py", line 799, in write
    self._sock.sendall(b)

Additional context The code did go through once, but I couldn't get it to print "hello" after, even after rebooting maya, visual studio code and resetting the port using the command found in visual studio code when I close maya: commandPort -n "localhost:7001" -stp "mel" -echoOutput;

Settings

Windows Edition: Windows 10 Home Version: 21H2 OS build: 19044.1706

Maya Version: Autodesk MAYA 2022

MayaCode Version: v1.5.0

artbycrunk commented 2 years ago

HI @Jordandionduval

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