用pycharm运行一小段爬虫的代码出现问题
11:58 Error running __init__: Cannot start process, the working directory 'E:\PyProgram\spider1' does not exist
网上找了很多都没解决,用其他IDE并不会出现这种情况,请问大神们怎么解决?
下面是我的代码(代码应该没问题把,毕竟其他IDE没出现问题
import urllib2
url = 'http://www.baidu.com'
print 'method one:'
response1 = urllib2.urlopen(url)
print response1.getcode()
print len(response1.read())
print 'method two:'
#header = ()
request = urllib2.Request(url)
request.add_header("user-agent", "Mozilla/5.0")
response2 = urllib2.urlopen(request)
print response2.getcode()
print len(response2.read())