#13 (Title) error in gp_win32.py

open
nobody
None
5
2012-09-17
2010-01-26
xaverxn
No

Hi, I experience a bug in the windows module that seems very similar to the last bug reported (ID 2038316, Error in gp_win32.py):

C:\Dokumente und Einstellungen\xaverw\Eigene Dateien>c:\Programme\Python2.6\pyth
on.exe
Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.

import Gnuplot
gp=Gnuplot.Gnuplot()
gp.title('Hello')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\Programme\Python2.6\lib\site-packages\Gnuplot_Gnuplot.py", line 473,
in title
self.set_label('title', s, offset=offset, font=font)
File "c:\Programme\Python2.6\lib\site-packages\Gnuplot_Gnuplot.py", line 410,
in set_label
self(string.join(cmd))
File "c:\Programme\Python2.6\lib\site-packages\Gnuplot_Gnuplot.py", line 210,
in call
self.gnuplot(s)
File "c:\Programme\Python2.6\lib\site-packages\Gnuplot\gp_win32.py", line 130,
in call
self.write(s + '\n')
IOError: [Errno 22] Invalid argument

I'd like to mention that this command (sequence) works just fine in linux...

Discussion

  • xaverxn
    xaverxn
    2010-01-27

    OK, I'm sorry, it seems this is merely when Gnuplot itself is not properly set up (or installed at all). I still think it's kind of a bug to give such a strange error message when a simple os.path.exists() cold tell that the path to gnuplot is missing...

     
  • Yes, this is the usual symptom when Gnuplot.py is unable to find a working gnuplot executable. The reason for the strange error message is apparently a strange characteristic of Windows that it doesn't give an error when trying to start the nonexistent binary, but only when Gnuplot.py tries to write the first command to the nonexistent gnuplot process. os.path.exists() would probably catch some cases, but not necessarily all of them (for example, if the gnuplot program cannot be started for some other reason. Feel free to submit a patch (I cannot test anything under Windows myself).

     
  • For me I was able to solve it when I did the following:

    In 'C:\Programme\python25\Lib\site-packages\Gnuplot\gp_win32.py' (or whatever your path is) change the line of pgnuplot.exe for example like this:
    gnuplot_command = r'C:\Programme\gnuplot\bin\gnuplot.exe'

    Hope it also works for you :) Please let me know if I was right!