[Zope] urllib.urlopen

Bakhtiar A Hamid kedai at kedai.com.my
Mon Aug 16 02:59:41 EDT 2004


On Monday 16 August 2004 06:33, David Siedband wrote:
> I'm trying to grab a data file using urllib.urlopen
>
> with this code:
>
> def powerData(self,REQUEST):
>     import csv
>     import urllib
>     inFile =
> urllib.urlopen('http://www.davisenergy.com/zeh_data/A042304.DAT')
>
> return inFile
>
> but I get the error:
> global name 'inFile' is not defined


the whole trace back would be nice

also, does this work from the command line?

<plug type="shameless">
check out Kebasdata sf.net/projects/kebasdata
it grabs data from accessable url, and then you can actually do stuff withit 
(thru Script (Python), or External Method) 

p/s - my member page at zope also has a howto.
</plug>


> I've also tried some variations on this:
>
>     inFile =
> "".join(urllib.urlopen('http://www.davisenergy.com/zeh_data/
> A042304.DAT').readlines())
>
>
> Ideas on what's not working?  thanks
>
> --
> David
>
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )


More information about the Zope mailing list