Home Download Buy Blog Forum Support

Available Modules and their content

Available Modules and their content

Postby emartel on Thu Mar 08, 2012 3:10 am

Hi,

Still learning about python, I just figured there's actually a csv module which would help a lot for my CSV plugin... BUT, as I try to use it I get:

AttributeError: 'module' object has no attribute 'reader'

At first I thought it was because my plugin was named csv.py, so for some namespace issues it would try to find reader from my plugin, but I've tried it in another of my plugins and I still get the error.

According to http://docs.python.org/library/csv.html the csv module and reader object are available since version 2.3, and if I'm not mistaken Sublime Text uses version 2.6?

I'm not sure if I misunderstand the language / its import system or what is made available to us but any help would be greatly appreciated!

Cheers

Eric
emartel
 
Posts: 23
Joined: Thu Feb 23, 2012 8:59 pm
Location: Montreal, Canada

Re: Available Modules and their content

Postby bizoo on Thu Mar 08, 2012 6:59 am

It works on Windows:
Code: Select all
>>> import csv
>>> csv.reader
<built-in function reader>

Calling your your plugin csv.py is not a good idea and probably the issue here.
Close ST2, rename it and try again. If you already imported YOUR csv module, renaming it without restarting the interpreter is useless.
bizoo
 
Posts: 889
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: Available Modules and their content

Postby emartel on Thu Mar 08, 2012 7:35 am

Thanks that's what I was suspecting... I'm used to other languages where the file names change nothing... I'll give it a try! Thank you

Edit: Confirmation, that was the issue
emartel
 
Posts: 23
Joined: Thu Feb 23, 2012 8:59 pm
Location: Montreal, Canada


Return to Plugin Development

Who is online

Users browsing this forum: Yahoo [Bot] and 6 guests