NumTut corrupted

Martin Franklin mfranklin1 at gatwick.westerngeco.slb.com
Tue Dec 2 03:19:52 EST 2003


On Tue, 2003-12-02 at 04:34, r.e.s. wrote:
> "Peter Hansen" wrote ...
> > "r.e.s." wrote:
> > > 
> > > No matter which site I download it from,
> > > NumTut.tgz appears to be corrupted.
> > > Anyone else having this problem?
> > 
> > Always describe the symptoms of a problem... what precise
> > behaviour (i.e. what extraction program, platform etc.) are
> > you encountering that leads you to believe it's corrupted?
> 
> Quite right, sorry. 
>  
> I resolved the problem, but will explain what happened 
> in case others encounter something similar ...
> 
> The file called NumTut.tgz at the SourceForge.net 
> download server is, when downloaded, automatically 
> receiving the wrong file extension by winXP . 
> (WinZip then produces a file that looks like a .py
> file corrupted by lots of 'unprintable' characters.)
> 
> That is, clicking NumTut.tgz for download results in 
> "You are requesting file: /numpy/NumTut.tgz
> Please select a mirror"
> 
> but the winXP File Download window that comes up says
>    File name:  NumTut.gz   (sic)
>    File type:  WinZip File
> 
> If renamed back to .tgz, WinZip decompresses it 
> properly, and I see that it's actually a number of 
> files which are python-importable when placed in 
> the folder ...\Numerical\NumTut.
> 
> (Also for other files from that site, I've sometimes
> had to re-download when the file is found not to be
> in recognizable format. This problem seems to occur 
> only for files downloaded from SourceForge, btw.)
> 
> =====
> A related python question, if I may ...
> 
> With the various .py files in \Numerical\NumTut, 
> *none* of which are named NumTut.py, why does this
> work? ...
> 
>     >>> from NumTut import *
> 
> Surely import doesn't use the folder name?  As you 
> can see, I'm a beginner at python.
> 

Yes it is using the folder name.  In this case there would be a file
named __init__.py inside the NumTut folder and the existance of this
file makes that folder a python package.  For more on python packages
(and more):

http://www.python.org/doc/current/tut/node8.html#SECTION008400000000000000000

(Above link may get wrapped by some news/mail readers)



Regards
Martin







More information about the Python-list mailing list