#9 Failure on Win32 when CWD is a UNC path

open
nobody
None
5
2014-08-26
2007-04-18
Grant Edwards
No

Gnuplot.Gnuplot() will fail to start a gnuplot process anytime
the current working directory (CWD) is a UNC path (e.g.
\host\foo\bar) rather than a DOS path (e.g. V:\foo\bar). The
underlying cause is a "feature" of cmd.exe documented at

http://support.microsoft.com/kb/156276/EN-US/

The symptom of this is that when you try to execute gnuplot
commands, you get a traceback like this when the write() on the
pipe to the child process fails:

Traceback (most recent call last):
File "testprog.py", line 34, in ?
gp('plot cos(x)')
File "Gnuplot_Gnuplot.pyc", line 199, in call
File "Gnuplot\gp_win32.pyc", line 125, in call
IOError: [Errno 22] Invalid argument

The fix is to use subprocess.Popen() with shell=False. The
subprocess module has it's own set of bugs under Win32 that you
have to work around:

http://www.py2exe.org/index.cgi/Py2ExeSubprocessInteractions

I'm currently testing a fix.

Discussion

  • Logged In: YES
    user_id=1361870
    Originator: NO

    We are looking to ship a 1.8 version of gnuplot.py

    Are you still working with this patch? Or did you do further changes.
    I don't have windows, so cannot test this myself.

     
  • Logged In: YES
    user_id=38106
    Originator: NO

    Please note that the Python subprocess module was only introduced in Python 2.4. Currently, Gnuplot.py claims to work with Python 1.5 or later.

    It seems absurd to continue to support Python 1.5, but a jump to Python 2.4 might cause problems for some users, especially if they are using Gnuplot.py in a server environment.

    If you want to support versions of Python older than 2.4 (for example, 2.2 is a nice version), then a backwards-compatible alternative to the subprocess module would have to be used whenever the Python version is older than 2.4.

    Personally, I think it would be fine to bump the Python requirement to 2.4, depending on the amount of screaming that causes.

    In any case, the new Python version requirement should be documented.