help with Installer?

Steven Taschuk staschuk at telusplanet.net
Sun Feb 23 23:23:35 EST 2003


Quoth Lance:
> I'm using McMillan's Installer (www.mcmillan-inc.net).
  [...]
> I receive a syntax error on the first line (import webbrowser) when running
> 
> python Build.py myfile.spec

What is the complete error message and traceback?

> However, line 1 is probably not the problem. I created a simple test file,
> foo.py, with the same import statements and a print 'hello world' as the
> last and only executed line in the file, after the import statements. I had
> no problems creating the executable using McMillan's Installer.

It would be helpful to see the code.  Could you post the file
which is failing?  (Cut it down as far as possible first, making
sure that the cut down version fails in the same way as the
original.  Post no more than, say, ten or twenty lines.)  It would
also help to see the working version.

The contents of that .spec file might also be nice to see.  (I
don't know anything about McMillan's Installer, so can't be sure
one way or the other.)

> I have only two ideas. First, my program uses command line arguments. Maybe
> some dummy arguments need to be supplied when running Makespec.py.  [...]

Hm.  I'd be surprised if this is relevant; absence of expected
command-line arguments will just cause sys.argv[1] or whatever to
fail at runtime (and not with a syntax error, but with an
IndexError).  But the installer's just compiling your program, I
assume, not running it.

> [...] Second,
> the file was copied from a DOS machine and has the DOS CR\LF at the ends of
> the lines.

Since you think this might be relevant, why not test it? That is,
remove the CRs and see if the result works.  On Unixlike boxes:
	$ tr -d '\r' <foo.py >tmp~
	$ mv tmp~ foo.py
or in Python:
	text = open('foo.py').read()
	text = text.replace('\r', '')
	open('foo.py', 'w').write(text)

-- 
Steven Taschuk                             staschuk at telusplanet.net
"I may be wrong but I'm positive."  -- _Friday_, Robert A. Heinlein





More information about the Python-list mailing list