len(sys.argv) in (3,4)

Tim Roberts timr at probo.com
Sat Aug 13 02:02:10 EDT 2005


Daniel Schüle <uval at rz.uni-karlsruhe.de> wrote:
>
>I just tried the same code at home and it worked fine
>it has to do with windows .. some settings or whatever
>(python 2.4.1 installed on both)
>
>maybe someone have experienced the same problem
>and had more luck in solving the puzzle

It's an installation problem, or maybe you tried to "fix" the installation
yourself.  I will wager real money that it works if you say this:
   python vhd2h.py vhd.vhd vhd.h -o   

When you omit the "python" name, the operating system has to figure out how
to run the command.  It does that by looking the extension up in the
registry, finding the command to run.

In a CMD shell, do this:

  c:\tmp> assoc .py
  .py=Python.File

  c:\tmp> ftype Python.File
I'm guessing yours will print something like this:
  Python.File=c:\Python24\python24.exe %1

The %1 is substituted with the name of the script being run.  In this
example, however, the parameters are all discarded.  If you set this
instead:

  c:\tmp> ftype Python.File=c:\python24\python23.exe "%1" "%*"

The "%*" says "put the rest of the parameters here."
-- 
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list