Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def send_photoshop(msg):
- conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- conn.settimeout(10)
- try:
- call = 0
- RETRY_COUNT = 10
- while call < RETRY_COUNT:
- try:
- hostname = socket.gethostname()
- HOST = socket.gethostbyname(hostname)
- logging.info("HOST OLD " + str(HOST))
- PORT = 8123
- conn_result = conn.connect_ex((HOST, PORT))
- logging.info(""
- "conn.connect_ex: " + str(conn_result) + "; HOST = " + str(HOST) + "; PORT = " str(PORT) + " " + str(traceback.format_exc()))
- conn.send(msg)
- break
- except BrokenPipeError:
- logging.info(
- "BrokenPipeError try conn.send(msg) FALL whith call = " + str(call) + " " + str(traceback.format_exc()))
- call+=1
- #TODO need to import time !!!!
- time.sleep(5) # wait 5 sec
- if platform == "win32":
- result = conn.recv(4096)
- logging.info(
- "conn.recv(4096) WINDOWS " + " " + str(traceback.format_exc()))
- else:
- result = None # conn.recv(4096)
- logging.info(
- "MAC result = None " + " " + str(traceback.format_exc()))
- # result = conn.recv(4096)
- logging.info(
- "conn.recv(4096) line " + " " + str(traceback.format_exc()))
- finally:
- conn.close()
- logging.info(
- "conn close " + str(traceback.format_exc()))
- if DEBUG:
- print(result)
- Error(None, 0, 15)
- return result
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement