Using open() under Window 97 (French)

Gaetan Corneau Gaetan_Corneau at baan.com
Fri Dec 3 12:00:26 EST 1999


Julien,

C'est le message d'erreur émit quand "open" ne trouve pas le fichier.
Si tu es sous UNIX, n'oublie pas que le répertoire courant n'est peut-être
pas dans ton PATH. 
Dans un shell, peux-tu écrire "vi sol.txt" ou bien dois-tu écrire "vi
./sol.txt" pour charger ton fichier dans vi?

Tu devrais donc écrire:

f=open('./sol.txt','r')

Si ça ne fonctionne toujours pas, essaie de spécifier le nom du fichier au
complet.

Bonne chance,
______________________________________________________
   Gaetan Corneau
   Software Developer (Quality Assurance Team)
   BaaN  Supply Chain Solutions  
   http://www.baan.com
   E-mail: Gaetan_Corneau at baan.com                  
   Tel: (418) 266-8252          
______________________________________________________
"Profanity is the one language all programmers know best"


> -----Original Message-----
> From: Julien Kahn [mailto:kahn at cena.dgac.fr]
> Sent: Friday, December 03, 1999 11:44 AM
> To: python-list at python.org
> Subject: Using open() under Window 97
> 
> 
> This program run under UNIX
>     import string
>     tab_line=[]
>     # ouverture du fichier
>     f=open('sol.txt','r')
>     # parcours du fichier
>     line=f.readline()
>     while line :
>          tab_line.append(string.split(line,';'))
>          print tab_line[-1]
>          line=f.readline()
>     f.close()
> 
> but under Window, even if the file is in current directory 
> I've got the
> fallowing message:
>     Traceback (innermost last):
>       File "C:\PROGRA~1\PYTHON\TOOLS\IDLE\ScriptBinding.py", 
> line 131, in
> run_module_event execfile(filename, mod.__dict__)
>       File 
> "C:\Utilisateurs\Julien\CENA\trafic\convertisseur.py", line 8, in
> ?
>       f=open('sol.txt','r')
>       IOError: [Errno 2] No such file or directory: 'sol.txt'
> 
> Thanks
> Julien
> 
> 
> 
> -- 
> http://www.python.org/mailman/listinfo/python-list
> 




More information about the Python-list mailing list