Sublime Forum

Available Modules and their content

#1

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 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

0 Likes

#2

It works on Windows:

[code]>>> import csv

csv.reader
[/code]
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.

0 Likes

#3

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

0 Likes