Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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