Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python CSV

dmitriy ignatiev
seal-mask
.a{fill-rule:evenodd;}techdegree
dmitriy ignatiev
Python Web Development Techdegree Student 1,789 Points

module csv has no attribute 'reader'

Hi,

I am stuck triyng to read csv file.

every time return AttributeError: that module csv has no attribute 'reader'. Please clarify what i am doing wrong. Thanks

import csv

with open('soccer_players.csv', newline='') as csvfile:
          r = csv.reader(csvfile, delimeter='|')
          for row in r:
            print(','.join(row))

[MOD: added ```python formatting -cf]

Ryan Oakes
Ryan Oakes
9,787 Points

It seems like a error with the csv module - you didn't happen to make a csv.py file anywhere in your directory or path that might be interfering?

zlatkap
zlatkap
21,494 Points

I had the same problem in PyCharm, where I created my own project and files. I solved it by changing the file name from "csv.py" to "my_csv.py". Reffered to problem on Stack Overflow. https://stackoverflow.com/questions/41061824/install-csv-package-in-pycharm/41062076#41062076?newreg=add2a0c7535848b79c6c6743da0390e8