Newbie Using "Programming Python" 1st Ed. Question

mowestusa justnotworking at mail.com
Mon Dec 16 16:22:45 EST 2002


I understand what you mean about using the * on the command line.  I was
thinking about when you run MS-DOS commands in the shell like xcopy you
don't have any trouble with the *, but I see your points about the *.  I
just wonder why it is written like that in "Programming Python."

You are also right Mel that I can list each of the Python files and it works
properly, but this is a bit of a hassel if you wanted to use the script to
work on 20 or 30 files at a time.  I should have mentioned that I had tried
that and it had worked.  I guess the book was misleading.  It sounds like
being a Unix user would be a better life, but Windows does make some things
very simple to do.

If anyone has good tutorials that deal with more real world examples of
using python in a Win98 situation, I would appreciate it.  Maybe I could
learn more from those examples than I'm learning from "Programming Python."

mowestusa

"Mel Wilson" <mwilson at the-wire.com> wrote in message
news:GSi/9ks/K/FC089yn at the-wire.com...
> 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