Re: [Python] newbie help
2013/2/22 emmanuel segura emi2f...@gmail.com try: import csv except ImportError: print Error loading csv module uhm, ho provato a riprodurre il problema e a me non succede però ti consiglierei prima di tutto di eliminare il try/except attorno all'istruzione di import molto meglio l'errore di sistema che non la tua print tanto più che, per come l'hai strutturato, il tuo script procede anche in caso di errore nell'importazione ciao, Marco ___ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python
Re: [Python] newbie help
non e' che banalmente non trova il file.csv ? Il 22/02/2013 10:00, emmanuel segura ha scritto: Ciao a tutti la lista Sto provando a imparare python, ho fatto questo piccolo script leggendo la documentazione Se faccio tutti gli steps dalla shell di python, non ricevo nessun errore, invece se lo lancio con ./csv.py va in error e anche se lo lancio con python csv.py Come distro Linux sto usando debian 6.06 con Python 2.6.6 = #!/usr/bin/python try: import csv except ImportError: print Error loading csv module fd = open(test.csv,rb) cs = csv.reader(fd) for row in cs: print ','.join(row) Output error = Traceback (most recent call last): File ./csv.py, line 4, in module import csv File /export/home/seguraem/python/csv.py, line 9, in module cs = csv.reader(fd) AttributeError: 'module' object has no attribute 'reader' = Grazie Emmanuel! -- esta es mi vida e me la vivo hasta que dios quiera ___ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python ___ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python
Re: [Python] newbie help
2013/2/22 emmanuel segura emi2f...@gmail.com = #!/usr/bin/python try: import csv except ImportError: print Error loading csv module Attenzione, è il nome del file che è csv.py che viene importato al posto del modulo. Ciao. Daniele ___ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python
Re: [Python] newbie help
giusto non me ne ero accorto :) Il 22/02/2013 10:17, Fabrizio Mancini ha scritto: devi cambiare il nome del file. csv.py non va bene. Chiamalo importa_csv.py o quello che vuoi. Se lo chiami come il modulo che importi con import csv python va in confusione, perchè il nome del tuo file andrà a sovrascrivere i metodi del modulo da te richiamato. Ciao f ___ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python ___ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python
Re: [Python] newbie help
Il giorno 22 febbraio 2013 10:17, Fabrizio Mancini mr.f...@gmail.com ha scritto: devi cambiare il nome del file. giusto! non avevo notato che l'OP aveva chiamato così il file ciao, Marco ___ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python