NEWB problem with urllib2
I just installed PyDev into Eclipse using the 'update' method and did
the standard installation. I allowed it to Auto Configure itself and
ran a "Hello World" module to make sure I was in the ballpark.
I got an starting module up and have run "Hello World" but now am
stuck on getting urlopen to import from urllib2 for the following
example.
from urllib2 import *# doesn't give me an error
ur = urlopen("http://www.daniweb.com/forums/thread161312.html";) #
gives me Undefined Variable: urlopen
so I tried just
import urllib2# Eclipse gives "Unresolved Import"
Is urllib2 not on my path? Isn't urllib2 in the standard installation
and shouldn't that automatically be on my path? If not, how can I get
it on the path?
ThankS!!
--
http://mail.python.org/mailman/listinfo/python-list
Re: NEWB problem with urllib2
Thanks Simon!
You are right.. I also believe it is something with Eclipse.
I've been working since... the module below runs.. but Eclipse is
still showing an error when I reference urlopen with a little red X...
saying it is an undefined variable in the IDE.. but not giving me an
runtime errors.
#URL LIBRARY
from urllib2 import *
def openfilereadaline(a):
f = open(a)
print f
for line in f:
print line.rstrip()
f.close()
def openWebSite(a):
ur = urlopen(a) #open url
contents = ur.readlines()#readlines from url file
fo = open("test.txt", "w")#open test.txt
for line in contents:
print "writing %s to a file" %(line,)
fo.write(line)#write lines from url file to text file
fo.close()#close text file
if __name__ == '__main__':
openWebSite("http://www.daniweb.com/forums/thread161312.html";)
print "Hello World"
--
http://mail.python.org/mailman/listinfo/python-list
Re: PyOBEX installation problem
Johny wrote: I tried to install PyOBEX Maybe this one instead? pip install PyOBEX see https://pypi.org/project/PyOBEX/ regards. -- https://mail.python.org/mailman/listinfo/python-list
