Problem porting class to python3.2
Ethan Furman
ethan at stoneleaf.us
Thu Jun 2 19:30:30 EDT 2011
Nick Buchholz wrote:
> First thanks to all who replied. FYI the classes in the file have been working in various
> environments since I wrote them in python1.3 and updated them to python 2.x in 2005.
>
> I think I solved the problem, well not solved in that I don't know why the technique I used failed.
> but at least the code works when used as an import.
>
> Under my 2.5 system I had a startup file that included the line
> ld = execfile
>
> mostly because I got tired of typing execfile('filename') to load in a file I was testing
>
> 2to3 complained it couldn't parse this line so I changed to
>
> def ld(filename):
> exec(compile(open(file).read(), file, 'exec'))
>
> when I tried
> ld('starDate.py') at the python3.2 prompt I got the indicated errors
Don't know if this helps at all, but when I tried your ld command (after
changing 'file' to 'filename' ;) it worked just fine.
~Ethan~
More information about the Python-list
mailing list