Skip to content

Fix urlopen call in _fetch() for QuantumRandom. #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

toffer
Copy link

@toffer toffer commented Mar 5, 2013

This issue looks like it was fixed in 0.1.3 available from PyPI, but here's what the error looks like in the most recent version on Github (0.1.1):

$ python
Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import randomSources
>>> import pkg_resources
>>> pkg_resources.get_distribution("RandomSources").version
'0.1.1'
>>> rng = randomSources.QuantumRandom()
>>> rng.randrange(1, 7)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "randomSources/quantumRandom.py", line 152, in randrange
    return int(istart + self._randbelow(width, generator))
  File "randomSources/quantumRandom.py", line 174, in _randbelow
    r = self.getrandbits(k, generator)
  File "randomSources/quantumRandom.py", line 96, in getrandbits
    r |= generator.next()
  File "randomSources/quantumRandom.py", line 74, in cached_generator
    for n in self._fetch(dataType, cacheSize, cacheSize):
  File "randomSources/quantumRandom.py", line 62, in _fetch
    data = json.loads(urllib2.urlopen(url).read(), object_hook=object_hook)
NameError: global name 'urllib2' is not defined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant