Python Forum
CSV unable to import (traceback error)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CSV unable to import (traceback error)
#1
Hey I'm new to Python programming

I wrote this code by seeing from youtube channel
import csv

with open ('example.csv', "r") as csvfile:
    readCSV = csv.reader(csvfile, delimiter=',')

    for row in readCSV:
        print(row)
Im getting the following error,

Traceback (most recent call last):
File "D:\OLD DATA\Readiris Pro 12\py\program\csv1.py", line 2, in <module>
import csv
File "D:\OLD DATA\Readiris Pro 12\py\program\csv.py", line 5, in <module>
with open('D:\OLD DATA\Readiris Pro 12\py\program\csvfile.csv') as csv1:
FileNotFoundError: [Errno 2] No such file or directory: 'D:\\OLD DATA\\Readiris Pro 12\\py\\program\\csvfile.csv'

<img src='https://i.imgur.com/QPYszQD.png' />
Reply
#2
remove/rename your D:\OLD DATA\Readiris Pro 12\py\program\csv.py file. you import it, not csv module and in it you try to open csvfile.csv which does not exists
Reply
#3
(Feb-09-2018, 03:14 PM)buran Wrote: remove/rename your D:\OLD DATA\Readiris Pro 12\py\program\csv.py file. you import it, not csv module and in it you try to open csvfile.csv which does not exists



Buran Bro

THANK YOU !!!

IT REALLY SOLVED MY PROBLEM
Reply
#4
By the way, looking at your files, same apply also for most of your other files - e.g. math.py, print.py, etc.
if you try to import math module from python standard library it will import your math.py file and it will not find the functions from the standard math module
or if in the future you import print.py in other script, then your print function will not work, etc.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Error on import: SyntaxError: source code string cannot contain null bytes kirkwilliams2049 7 6,149 Aug-03-2023, 06:00 PM
Last Post: Gribouillis
  import module error tantony 5 3,358 Dec-15-2022, 01:55 PM
Last Post: Lauraburmrs
  Python Traceback Error mg24 2 903 Nov-21-2022, 02:35 PM
Last Post: snippsat
  Cryptic Error with import statement Led_Zeppelin 2 2,478 Jan-11-2022, 01:13 PM
Last Post: Led_Zeppelin
  Install any library via pip get an error cannot import name 'SCHEME_KEYS' from 'pip. Anldra12 2 10,488 Jan-04-2022, 01:05 PM
Last Post: Anldra12
  Unable to import sklearn after installing any package ilango 0 1,160 Oct-25-2021, 07:03 AM
Last Post: ilango
  Unable to import Private Repo using setup.py Bob786 1 1,706 Sep-02-2021, 04:19 PM
Last Post: snippsat
  import module with syntax error Skaperen 7 5,158 Jun-22-2021, 10:38 AM
Last Post: Skaperen
  Import Error Christian 3 3,130 Apr-17-2021, 11:27 PM
Last Post: bowlofred
  Folium import error kashif_flavio 2 3,567 Dec-07-2020, 08:58 AM
Last Post: bowlofred

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020