Repository: psychopy/psychopy

Issue:
runTimeInfo error (timeout) if internet connection shaky
Call to RunTimeInfo 

```
runInfo = info.RunTimeInfo(
        # if you specify author and version here, it overrides the automatic detection of __author__ and __version__ in your script
        #author='<your name goes here, plus whatever you like, e.g., your lab or contact info>',
        #version="<your experiment version info>",
        win=myWin,    ## a psychopy.visual.Window() instance; None = default temp window used; False = no win, no win.flips()
        refreshTest='grating', ## None, True, or 'grating' (eye-candy to avoid a blank screen)
        verbose=True, ## True means report on everything 
        userProcsDetailed=False  ## if verbose and userProcsDetailed, return (command, process-ID) of the user's processes
                                #seems to require internet access, probably for process lookup
        )
```

can yield this:

Traceback (most recent call last):
  File "dots.py", line 92, in <module>
    userProcsDetailed=False  ## if verbose and userProcsDetailed, return (command, process-ID) of the user's processes
  File "/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/info.py", line 98, in **init**
    self._setSystemInfo() # current user, locale, other software
  File "/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/info.py", line 304, in _setSystemInfo
    self['systemHaveInternetAccess'] = web.haveInternetAccess()
  File "/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/web.py", line 43, in haveInternetAccess
    urllib2.urlopen(site, timeout=wait)
  File "urllib2.pyc", line 126, in urlopen
  File "urllib2.pyc", line 400, in open
  File "urllib2.pyc", line 418, in _open
  File "urllib2.pyc", line 378, in _call_chain
  File "urllib2.pyc", line 1207, in http_open
  File "urllib2.pyc", line 1180, in do_open
  File "httplib.pyc", line 1030, in getresponse
  File "httplib.pyc", line 407, in begin
  File "httplib.pyc", line 365, in _read_status
  File "socket.pyc", line 447, in readline
socket.timeout: timed out



Discussion:
I am also having this problem occasionally. Did you figure anything out?

not really. had the impression that turning off some of the tests with the
flagshelped, but i think it happened againonce even after that

On Mon, Jan 12, 2015 at 12:48 PM, Cmell notifications@github.com wrote:

>  I am also having this problem occasionally. Did you figure anything out?
> 
> —
> Reply to this email directly or view it on GitHub
> https://github.com/psychopy/psychopy/issues/741#issuecomment-69522707.

## 

Alex Holcombe | Associate Professor
School of Psychology | Faculty of Science
The University of Sydney
Web http://www.psych.usyd.edu.au/staff/alexh/lab/, Twitter
https://twitter.com/ceptional, Map
http://openwetware.org/wiki/Holcombe:Location


Resolving patch:
diff --git a/psychopy/web.py b/psychopy/web.py
--- a/psychopy/web.py
+++ b/psychopy/web.py
@@ -34,7 +34,7 @@ def haveInternetAccess(forceCheck=False):
     If forceCheck is False, will rely on a cached value if possible.
     """
     global haveInternet
-    if forceCheck or haveInternet not in [True, False]:
+    if forceCheck or haveInternet is None:
         # try to connect to a high-availability site
         sites = ["http://www.google.com/", "http://www.opendns.com/"]
         for wait in [0.3, 0.7]:  # try to be quick first
@@ -43,7 +43,7 @@ def haveInternetAccess(forceCheck=False):
                     urllib2.urlopen(site, timeout=wait)
                     haveInternet = True  # cache
                     return True  # one success is good enough
-                except urllib2.URLError:
+                except:  # urllib2.URLError:  # socket.timeout() was happening to some people some of the time
                     pass
         else:
             haveInternet = False


Test patch: