Python 2.7 and Flask - using functions from "Random" module returns "500 Internal Server Error" when using venv
Question: I'm testing a web service written with python and flask. Within that service I
want to generate a random number. None of the solutions posted on the web seem
to work, **as if the "random" module does not work.** I checked, and there's
no random.py or random.pyc within the folders around the webservice.py

Here's how I start the web service:

    
    
    $ . venv/bin/activate
    $ python webservice.py
    

**How can I fix random module not being available when running in a virtual
environment?**

    
    
    import random
    from random import randint
    
    x = random.random()*100
    x = randint(0,10)
    print 'r' + x #does not work 
    

Here's what's in the venv folder:

![enter image description here](http://i.stack.imgur.com/VAFUo.png)


Answer: Check to see if the help("random") method will give a list.

  * Then reinstall the module in that venv. Also what is in the lib folder?

a link to help.

<https://docs.python.org/2/library/random.html>

