Python Forum
petit problème python - Printable Version

+- Python Forum (
+-- Forum: Python Coding (
+--- Forum: General Coding Help (
+--- Thread: petit problème python (/thread-15542.html)

petit problème python - salahoum - Jan-21-2019

def extraction_donnees(texte):
    fichier = open(texte)
    contenu =

    lignes = contenu.split('\n')
    print (lignes)

Traceback (most recent call last): File "C:\Users\hp\Desktop\Nouveau dossier\", line 9, in <module> extraction_donnees("democraphique.csv") File "C:\Users\hp\Desktop\Nouveau dossier\", line 2, in extraction_donnees fichier = open(texte) FileNotFoundError: [Errno 2] No such file or directory: 'democraphique.csv'

RE: petit problème python - Larz60+ - Jan-21-2019

The error is explaining that it cannot find a file with the name: 'democraphique.csv' in the directory named: 'C:\Users\hp\Desktop\Nouveau dossier\'
if the file does exist, and there are no spelling errors, you may be get an error of this sort if
the source file is located in a directory other than where the program resides (if using virtual environment, for example).
Or if the file is in a different directory than the script source you will get this error.

is '' actually part of the directory name?