Reputation: 8546
I'm trying to create a virtualenv and carefully track all dependencies. I created the env this way:
virtualenv --no-site-packages purenv
cd purenv
source bin/activate
Then run this python script:
url = "http://localhost:6543/foo/",
hdrz = {
"Accept" : "text/html",
"account-code":"foo1234",
'Content-Type': 'application/json'
}
request = urllib2.Request(url, headers=hdrz)
I get this error:
File "foo.py", line 10, in <module>
request = urllib2.Request(url, headers=hdrz)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 229, in __init__
self.__original = unwrap(url)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 1075, in unwrap
url = url.strip()
AttributeError: 'tuple' object has no attribute 'strip'
which python
/Users/foo.bar/workspace/purenv/bin/python
So, I'm using the python installed to the virtualenv, but the error is coming from outside the virtualenv (/System/Library/Frameworks/...
and not purenv/lib/python2.7/site-packages...
or the like).
How can I create a virtualenv where no external files are called?
Upvotes: 1
Views: 437
Reputation: 515
Change:
url = "http://localhost:6543/foo/",
To:
url = "http://localhost:6543/foo/"
You are sending a tuple, not a str. Sorry for the bad english.
Upvotes: 1