can't pass command-line arguments

Duncan Booth duncan.booth at invalid.invalid
Mon Apr 10 09:08:16 EDT 2006


BartlebyScrivener wrote:

>>> That is wrong on so many levels
> 
> Including the level where I observed that I'd already been running
> scripts without typing the .py extension for months, it's just that on
> some scripts (seems to be the ones with functions defined in them) you
> can't pass arguments unless you type the .py extension.
> 
There is a problem (which I think is finally fixed in XP) where you 
couldn't redirect I/O when running Python scripts via PATHEXT, but that 
doesn't sound like your problem.

Defining functions, or not, doesn't sound like it should affect the 
arguments, except maybe if making your script longer had an effect, but I 
have no problems running a long script with arguments.

What does the command "ftype Python.File" print on your system? If it is 
wrong that could easily stop arguments being passed to scripts run by 
entering the script name, but it ought to break them all whether or not you 
type the extension explicitly.

The only other thing I can think is that you might already have a 
findmyfiles.bat (or cmd/com/exe etc.) which is the one being picked up in 
place of the Python script when you don't specify an extension. That could 
certainly explain the behaviour.



More information about the Python-list mailing list