[Tutor] Example prog

amoreira@mercury.ubi.pt amoreira@mercury.ubi.pt
Sun, 27 Aug 2000 02:25:51 +0100


Hi!
Your invocation of the script, where you say
> C:\python>python pack1.py *.txt > stuff.txt
tries to open all files with .txt extension in the current directory. If
you don't have any, the script ends with that error message. Are you
sure to have a .txt file in the working dir?
I hope that that's it!
Cheers, Ze

"Daniel D. Laskey" wrote:
> 
> I recently purchased "Programming Python" and I'm working through the examples.
> On page 83 Mark has a simple program called pack1.py.  What am I doing wrong?
> 
> Page 83, Programming Python
> 
> import sys
> marker = '::::::'
> 
> for name in sys.argv[1:]:
>         input = open(name, 'r')
>         print marker + name
>         print input.read(),
> 
> C:\python>python pack1.py *.txt > stuff.txt
> 
> Traceback (innermost last):
>   File "pack1.py", line 5, in ?
>     input = open(name, 'r')
> IOError: [Errno 2] No such file or directory: '*.txt'
> 
> Daniel D. Laskey, CPA
> dlaskey@laskeycpa.com
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://www.python.org/mailman/listinfo/tutor