Newbie Using "Programming Python" 1st Ed. Question

Mel Wilson mwilson at the-wire.com
Mon Dec 16 14:07:50 EST 2002


In article <uvs04c35nco2b4 at corp.supernews.com>,
"mowestusa" <justnotworking at mail.com> wrote:
>I hope you can help.  I only have experience programming macros in Word,
>WordPerfect, NoteTab, and some Batch File stuff.  So I'm learning computer
>programming from scratch.
>
>I have gone through the "Learning Python for Beginners" and the tutorial at
>the end of "Programming Python", but neither of those explain why I'm
>getting this error.  I'm doing the example in chapter 4 of the "pack1.py"
>and "unpack1.py".
>
>I'm getting this error message:
>C:\MyTemp\test1>python pack1.py *.py > upload.txt
>
>Traceback (most recent call last):
>  File "pack1.py", line 9, in ?
>    input = open(name, 'r')
>IOError: [Errno 2] No such file or directory: '*.py'
>
>Now I know that it must be having trouble with the * but I don't understand
>why.  This is exactly how Mark Lutz tells you to write out the command on
>the command line.  You can use * all the time on the command line and MS-DOS
>knows what you want.

   I doubt this strongly.  Unix or Linux or one of the BSDs
will know what you want, but not MS-DOS.  The command shell
in Uniix, etc. will substitute '*.py' with the list of
matching file names, so that pack1.py never sees the string
'*.py'.  Not so for MS-DOS.

   If you explicitely run the command

python pack1.py A.py B.py C.py >upload.txt

with 'A', 'B', 'C' replaced by the first parts of the
names of some python files, you may get a better result.

        Regards.        Mel.



More information about the Python-list mailing list