From: Michael H. <mh...@al...> - 2005-11-07 11:14:48
|
Noel O'Boyle wrote: > Problem: > > On Windows, if your user name contains an apostrophe, the use of > temporary files causes an error, as gnuplot uses apropostrophes (i.e. > single quotes) to delimit the filename. > > gnuplot> plot 'c:\docume~1\noelo'~1\locals~1\temp\tmpcxnwsm' notitle > ^ > invalid character > > > Solution: > > If you replace the single quotes with double quotes, gnuplot is happy > with the apostrophe but misinterprets the backslashes as escape > character sequences. > > gnuplot> plot "c:\docume~1\noelo'~1\locals~1\temp\tmpcxnwsm" notitle > ^ > can't read data file "c:docume~1 > oelo'~1locals~1 emp mpcxnwsm" > > ....so you need to also replace all of the backslashes with forward > slashes. > > gnuplot> plot "c:/docume~1/noelo'~1/locals~1/temp/tmpcxnwsm" > notitle > > **Success!!** Hello, Thanks for the information and the patch. Won't your patch create new problems for filenames that contain double-quotes? Or is that somehow forbidden? What if a filename contains single-quotes *and* double-quotes? In other words, is there a way to solve this problem in such a way that it works for *all* legitimate Windows filenames? Regarding your specific proposed patch: 1. I think the conversion of filenames should happen via a call to the os-specific code. 2. string.replace() would be easier than an explicit loop. Michael |