Opened 10 years ago

Closed 10 years ago

#267 closed defect (worksforme)

NX not working on windows

Reported by: Nathan Rennie-Waldock Owned by: Nathan Rennie-Waldock
Priority: major Milestone:
Component: NX Keywords:
Cc:

Description

Xming is failing to launch because one of the PATH variables is unicode and Python 2.7 doesn't accept unicode there.

[EE] 2014/18/09 15:15:47.722000 process_util.exec_nopipe(['C:\\Program Files (x86)\\WinSwitch\\Xming\\Xming.exe', ':6066', '-ac', '-multiwindow', '-clipboard', '-notrayicon'],None,None,False,False,None,True)
[ee] 2014/18/09 15:15:47.722000 Traceback (most recent call last):
[ee] 2014/18/09 15:15:47.722000   File "winswitch\util\process_util.pyc", line 119, in exec_nopipe
[ee] 2014/18/09 15:15:47.722000   File "subprocess.pyc", line 709, in __init__
[ee] 2014/18/09 15:15:47.722000   File "subprocess.pyc", line 957, in _execute_child
[ee] 2014/18/09 15:15:47.722000 TypeError: environment can only contain strings
[DD] 2014/18/09 15:15:47.722000 Xming_Util.start_Xming_display() xming process failed... None
[II] 2014/18/09 15:15:47.732000 NXClientUtil.Xming_err(coult not start Xming process)

Fix would be to add for k, v in env.items(): env[k] = str(v) to exec_nopipe in winswitch/util/process_util.py

I've tested this in a Python shell since I'm not set up to build WinSwitch?.

>>> from subprocess import Popen
>>> env = {'GST_PLUGIN_PATH': u'C:\\Program Files (x86)\\WinSwitch\\gstreamer-0.10'}
>>> Popen("notepad", env=env)

Traceback (most recent call last):
  File "<pyshell#40>", line 1, in <module>
    Popen("notepad", env=env)
  File "C:\Portable Python 2.7.6.1\App\lib\subprocess.py", line 709, in __init__
    errread, errwrite)
  File "C:\Portable Python 2.7.6.1\App\lib\subprocess.py", line 957, in _execute_child
    startupinfo)
TypeError: environment can only contain strings

>>> for k, v in env.items(): env[k] = str(v)

	
>>> Popen("notepad", env=env)
<subprocess.Popen object at 0x02818410>

Change History (2)

comment:1 Changed 10 years ago by Antoine gmail

Owner: set to Nathan Rennie-Waldock
Status: newassigned

I am bit puzzled looking at this code.
I'm not getting this error, and start_Xming_display doesn't specify new env variables to use, so it must be in the default code path, which is also used for launching other tools (xpra, vnc and others) - why aren't those failing?
Does r5296 help?

comment:2 Changed 10 years ago by Nathan Rennie-Waldock

Resolution: worksforme
Status: assignedclosed

It seems xpra failing may have messed up the environment, I can't reproduce today.

Note: See TracTickets for help on using tickets.