[Tutor] Virtual environment question

Jim jf_byrnes at comcast.net
Sun Mar 11 20:44:41 EDT 2018


On 03/11/2018 05:54 PM, Cameron Simpson wrote:

Note: This message came straight to me and I haven't seen it on the list 
yet. Hopefully this reply will make it to the list.

> On 11Mar2018 15:52, jim <jf_byrnes at comcast.net> wrote:
>> It was my understanding that using a virtual environment kept 
>> everything isolated in that environment. So I was surprised when I got 
>> the following error message.
>>
>> (env) jfb at jims-mint18 ~ $
>>
>> <snip>
>> File 
>> "/home/jfb/EVs/env/lib/python3.5/site-packages/selenium/webdriver/remote/remote_connection.py", 
>> line 528, in _request
>>    resp = opener.open(request, timeout=self._timeout)
>>
>>  File "/usr/lib/python3.5/urllib/request.py", line 466, in open
>>    response = self._open(req, data)
>> <snip>
>>
>> I snipped most of the error msg because for the purpose of this 
>> question I am not interested in them. I tried  something that I did 
>> not think would work and it did not.
>>
>> I am wondering why the path for the first line and every line above it 
>> is /home/jfb/EVs/env and the second line and everything after is is
>> /usr/lib/.
>>
>> I didn't think anything from my system python would be involved if I 
>> started from a virtual environment.
> 
> It is possible to make a virtualenv which references the osurce python's 
> library. These days the default is isolation, but older virtualenvs used 
> to hook to the original python by default. This is controlled by 
> virtualenv's --system-site-packages and --no-site-packages. Maybe you 
> should build the env again using --no-site-packages explicitly and see 
> if the behaviour changes.
> 
> If you're not using the "virtualenv" command to make the environment, 
> please tell use exactly how it was made (there are other tools for the 
> same purpose).
> 
> In fact, tell us regardless. It aids debugging.
> 
> Cheers,
> Cameron Simpson <cs at cskk.id.au> (formerly cs at zip.com.au)

I installed pyvenv in Jan 17 using synaptic on  Mint 18.

Here are the contents of the pyvenv cfg file:

home = /usr/bin
include-system-site-packages = false
version = 3.5.2

It's been awhile so I don't remember that much about the installation. I 
really don't know that much about virtual environments so I am guessing 
I accepted the defaults for the installation.

Just to be complete here is the entire error msg:

Traceback (most recent call last):
   File "/home/jfb/MyProgs/Scripts/login_af.py", line 36, in <module>
     driver = webdriver.Remote(desired_capabilities=caps)
   File 
"/home/jfb/EVs/env/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", 
line 154, in __init__
     self.start_session(desired_capabilities, browser_profile)
   File 
"/home/jfb/EVs/env/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", 
line 243, in start_session
     response = self.execute(Command.NEW_SESSION, parameters)
   File 
"/home/jfb/EVs/env/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", 
line 310, in execute
     response = self.command_executor.execute(driver_command, params)
   File 
"/home/jfb/EVs/env/lib/python3.5/site-packages/selenium/webdriver/remote/remote_connection.py", 
line 466, in execute
     return self._request(command_info[0], url, body=data)
   File 
"/home/jfb/EVs/env/lib/python3.5/site-packages/selenium/webdriver/remote/remote_connection.py", 
line 528, in _request
     resp = opener.open(request, timeout=self._timeout)
   File "/usr/lib/python3.5/urllib/request.py", line 466, in open
     response = self._open(req, data)
   File "/usr/lib/python3.5/urllib/request.py", line 484, in _open
     '_open', req)
   File "/usr/lib/python3.5/urllib/request.py", line 444, in _call_chain
     result = func(*args)
   File "/usr/lib/python3.5/urllib/request.py", line 1282, in http_open
     return self.do_open(http.client.HTTPConnection, req)
   File "/usr/lib/python3.5/urllib/request.py", line 1256, in do_open
     raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 111] Connection refused>

If you tell me where to look, I'd be happy to provide any more info you 
need.


Regards,  Jim


More information about the Tutor mailing list