can't pass command-line arguments

Peter Hansen peter at engcorp.com
Mon Apr 10 11:25:00 EDT 2006


BartlebyScrivener wrote:
> Well, I tried to let this die because I just KNEW I was going to look
> like an idiot before it was over. It's the .pyc versus the .py file.
> Obviously I don't understand how that works yet. The .pyc file lags
> behind the .py file?  So when I run cbfindfiles.py I'm running the .py
> version and when I run cbfindfiles it's running the .pyc version which
> is not the same between edits.

I thought of that one, of course, but it can't cause exactly the trouble 
you describe above.  If there's a .py in the same folder as the .pyc, it 
will not use the .pyc unless the timestamp encoded in it matches the one 
on the .py file (which, unless you go to extraordinary lengths, will 
never screw you up that way).

On the other hand, if there was a .pyc in the current directory when you 
run it with "python cbfindfiles.py", but no cbfindfiles.py in the same 
folder, it will run the local one and not the .py which might be 
elsewhere, in your PATH.  Any chance there are cbfindfiles.py* files in 
other folders or have you been doing this all from the same folder?

> No need to explain. I'll go read up on how that .pyc file is generated.

Don't think you look like an idiot (yet :-) ).  Not only has everyone 
been caught out by this, sometimes repeatedly (ah... it happened to a 
"friend" of mine a number of times), but when you combine the weirdness 
of Windows PATHEXT and FTYPE and such, you can really get into awkward 
situations.

I do hope you'll identify precisely what the issue was, so we can keep 
it in mind (if it's a new variant), or refresh our knowledge (if it's 
just the same old same old but we didn't realize it yet).

Thanks. :-)
-Peter




More information about the Python-list mailing list