parse() parsea un fichero, por lo tanto espera una ruta en su lugar debieras utilizar fromstring()
http://docs.python.org/library/xml.etree.elementtree.html#xml.etree.ElementTree.fromstring 2012/5/27 FERNANDO VILLARROEL <fvillarr...@yahoo.com>: > Hola amigos. > > Quisiera alguna ayuda lo que sucede es que hay un proceso que mediante POST > envia un XML a un CGI, entonces en ese CGI debo parsear y extraer ciertos > valores para meterlos en una base de datos. > El asunto es que no lo consigo > > > #!/usr/bin/python > > print "Content-type: text/html\n" > > import xml.etree.ElementTree as et > import cgi > > form = cgi.FieldStorage() > xmlcdr=str(form['cdr'].value) > #xmlc=et.fromstring(xmlcdr) > xmlc=et.parse(xmlcdr) > > > Este codigo me tira el siguiente error: > > [Sat May 26 11:30:55 2012] [error] [client 127.0.0.1] File > "/usr/lib/cgi-bin/cdr.py", line 15, in <module> > [Sat May 26 11:30:55 2012] [error] [client 127.0.0.1] > xmlc=et.parse(xmlcdr) > [Sat May 26 11:30:55 2012] [error] [client 127.0.0.1] File > "/usr/lib/python2.6/xml/etree/ElementTree.py", line 862, in parse > [Sat May 26 11:30:55 2012] [error] [client 127.0.0.1] tree.parse(source, > parser) > [Sat May 26 11:30:55 2012] [error] [client 127.0.0.1] File > "/usr/lib/python2.6/xml/etree/ElementTree.py", line 579, in parse > [Sat May 26 11:30:55 2012] [error] [client 127.0.0.1] source = > open(source, "rb") > [Sat May 26 11:30:55 2012] [error] [client 127.0.0.1] IOError > [Sat May 26 11:30:55 2012] [error] [client 127.0.0.1] : [Errno 36] File name > too long: '<?xml version="1.0"?> > > Alguna idea o sugerencia que me ayude. > > Fernando > _______________________________________________ > Python-es mailing list > Python-es@python.org > http://mail.python.org/mailman/listinfo/python-es > FAQ: http://python-es-faq.wikidot.com/ -- Sergio Fernández <ser...@wikier.org> _______________________________________________ Python-es mailing list Python-es@python.org http://mail.python.org/mailman/listinfo/python-es FAQ: http://python-es-faq.wikidot.com/