From: Grant E. <gr...@vi...> - 2007-04-18 18:51:49
|
On Wed, Apr 18, 2007 at 08:44:23PM +0200, Michael Haggerty wrote: > Grant Edwards wrote: > > [...] > > What refuses to work is when the program is started by clicking > > on a file whose type has been associated with the program. In > > that case, I always get an "invalid parameter" IOError when > > gp_win32.py writes to the pipe in its __call__ method. > > I think that is the error that results if Gnuplot.py is not able to > start the "pgnuplot.exe" binary. Perhaps you have a PATH problem? I'm setting the complete path to pgnuplot.exe in GnuplotOpts. The program works fine when started by: 1) command line from any directory (local or networked). 2) desktop shortcut icon with any 'start in' directory (local or networked). 3) double-clicking an associated file in any local directory. It only fails when one double-clicks an associated fine in a network directory. I've verified that in all cases the correct path to pgnuplot.exe is being used. The program doesn't try to open or access any files in the current directory. All it does is this: #!/usr/bin/env python import sys,math,tempfile,os,itertools,wx from wx.lib.floatcanvas import NavCanvas, FloatCanvas, Resources import wx.lib.colourdb from sectionedFile import SectionedFile import Gnuplot # if we're on a Windows system and there's a pgnuplot.exe file # in our "install" directly, tell the Gnuplot module to use # that instead of whatever's in our PATH sys.stderr.write("cwd: %s\n" % os.getcwd()) if sys.platform == 'win32': installpath = os.path.abspath(os.path.dirname(sys.argv[0])) gnuplotpath = os.path.join(installpath,'pgnuplot.exe') sys.stderr.write("installpath '%s'\n" % installpath) sys.stderr.write("gnuplotpath '%s'\n" % gnuplotpath) if os.path.isfile(gnuplotpath): if ' ' in gnuplotpath: gnuplotpath = '"' + gnuplotpath + '"' Gnuplot.GnuplotOpts.gnuplot_command = gnuplotpath; sys.stderr.write( "using pgnuplot at %s\n" % Gnuplot.GnuplotOpts.gnuplot_command) else: sys.stderr.write("didn't find pgnuplot at %s -- hope it's in your path...\n" % gnuplotpath); import time gp = Gnuplot.Gnuplot(debug=1) gp('plot sin(x)') time.sleep(1) gp('plot cos(x)') time.sleep(1) gp('plot tan(x)') time.sleep(1) sys.exit(0) -- Grant Edwards gr...@vi... |