#9 Failure on Win32 when CWD is a UNC path


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


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:


I'm currently testing a fix.


  • Benny Malengier

    Benny Malengier - 2008-01-14

    Logged In: YES
    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.

  • Michael Haggerty

    Logged In: YES
    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.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks