can't pass command-line arguments
Peter Hansen
peter at engcorp.com
Mon Apr 10 12:09:27 EDT 2006
BartlebyScrivener wrote:
> It has something to do with importing the cbfindfiles.py file as a
> module, right? Because I just did that, and now the .py and .pyc files
> are synchronized, and I'm getting the same result when I run
> cbfindfiles or cbfindfiles.py, whereas before I was not.
Yes! That's the only reason you have a .pyc file at all. Normally, for
little command line scripts, Python doesn't even bother saving the
compiled code in the .pyc file. It does, however, always do this when
you use "import" so, having once imported it, you'll have that
out-of-date .pyc file kicking around forever as a latent problem.
> Thank you so much for your generous help.
You're welcome, and thanks for following this through. I still have
machines around that have PATHEXT=.pyc;.py;... and will now remove .pyc
from all of them. It would probably be nice to trace this back to the
origin, find whether there was a good rationale for it being that way in
the first place, and either update a FAQ somewhere or get the problem
fixed once and for all.
I don't think the standard install messes with PATHEXT, so my bet is on
ActiveState right now. Can anyone confirm? Trent, if you're reading
this and it is from ActiveState's distribution, do you know where that
PATHEXT=.pyc;.py choice came from and whether it might have been an
ill-advised decision that should be undone?
-Peter
More information about the Python-list
mailing list