Skip to content

Commit

Permalink
removes extra whitespace and null terminator making it into the attac…
Browse files Browse the repository at this point in the history
…h_pydevd output
  • Loading branch information
cmcpasserby committed Mar 17, 2021
1 parent 0af74b3 commit c0756c4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions src/main/resources/python/attach_pydevd.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ def process_command_line(argv):

def send_command(port, message):
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(("localhost", port))
client.sendall('python("' + message.replace(r'"', r'\"') + '")')
data = client.recv(1024)
if data and not data.startswith("None"):
print(data)
client.close()
try:
client.connect(("localhost", port))
client.sendall('python("' + message.replace(r'"', r'\"') + '")')
data = client.recv(1024)
if data.strip().strip("\x00"):
print(data)
finally:
client.close()


def main(setup):
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/python/attach_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def attach(port, host):
trace_only_current_thread=False,
patch_multiprocessing=False,
)
print("successfully attached to maya")
print("Successfully attached to Maya")
except:
import traceback
traceback.print_exc()

0 comments on commit c0756c4

Please sign in to comment.