deemel
deemel

Reputation: 1036

aifc module Error: Python won't open file

I'm just getting started with python so please bear with me ;)

While following a basic tutorial I ran into a problem while opening a file, here's the traceback:

File "/home/nick/Dropbox/workspace/pytest/schlange.py", line 55, in <module>
        f=open("file.csv","r")   
File "/usr/lib/python2.6/aifc.py", line 922, in open
        return Aifc_read(f)   
File "/usr/lib/python2.6/aifc.py", line 335, in __init__
        self.initfp(f)   
File "/usr/lib/python2.6/aifc.py", line 288, in initfp
        raise Error, 'file does not start with FORM id' 
aifc.Error: file does not start with FORM id

Does that mean that 'aifc.py' in my python installation is broken or did I miss something important here?

Upvotes: 0

Views: 1910

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 799150

You've decided to import * from aifc, and its open() has shadowed the built-in open(). This is why we don't import *. Import the module itself instead and use the reference to get to its names when required, e.g. aifc.open().

Upvotes: 3

Related Questions