title: Python 2.7 on Mac OSX. can not import random package Environment getting corrupted
body: <pre class="lang-none prettyprint-override"><code>Last login: Tue Nov  5 15:13:08 on ttys000 
  Preetis-MacBook-Pro:~ preetigupta25$ which python
  /Library/Frameworks/Python.framework/Versions/2.7/bin/python
  Preetis-MacBook-Pro:~ preetigupta25$ /Library/Frameworks/Python.framework/Versions/2.7/bin/python
  Python 2.7.6rc1 (v2.7.6rc1:4913d0e9be30+, Oct 27 2013, 20:52:11) 
  [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
  Type "help", "copyright", "credits" or "license" for more information.
  &gt;&gt;&gt; import random
  &gt;&gt;&gt; ^D
  Preetis-MacBook-Pro:~ preetigupta25$ /usr/bin/python
  Python 2.7.6rc1 (v2.7.6rc1:4913d0e9be30+, Oct 27 2013, 20:52:11) 
  [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
  Type "help", "copyright", "credits" or "license" for more information.
  &gt;&gt;&gt; import random
  &gt;&gt;&gt; ^D
  Preetis-MacBook-Pro:~ preetigupta25$ cd /Users/preetigupta25/Documents/lab\ work/Economic\ modelling/src
  -bash: cd: /Users/preetigupta25/Documents/lab work/Economic modelling/src: No such file or directory
  Preetis-MacBook-Pro:~ preetigupta25$ cd /Users/preetigupta25/Documents/lab\ work/Economic\ modelling/Preeti_model/src
  Preetis-MacBook-Pro:src preetigupta25$ ./model.py
  Traceback (most recent call last):
    File "./model.py", line 5, in &lt;module&gt;
      from random import generate_random_no
    File "/Users/preetigupta25/Documents/lab work/Economic modelling/Preeti_model/src/random.py", line 4, in &lt;module&gt;
      from random import random
  ImportError: cannot import name random
  Preetis-MacBook-Pro:src preetigupta25$ python
  Python 2.7.6rc1 (v2.7.6rc1:4913d0e9be30+, Oct 27 2013, 20:52:11) 
  [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
  Type "help", "copyright", "credits" or "license" for more information.
  &gt;&gt;&gt; import random
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "random.py", line 4, in &lt;module&gt;
      from random import random
  ImportError: cannot import name random
  &gt;&gt;&gt; 
  </code></pre>
  
  <p>I have Python 2.7.6 on my Mac OSX. I am trying to include random module in my python script which is not working.<br></p>
  
  <p>If you see above, import random works fine on python prompt. But as soon as I run my script :( it can't find random module and after that I can not import random on python prompt as well.
  <br>
  My script is having #!/usr/bin/python as the first line. 
  <br></p>
  
  <pre><code>import os
  import sys
  
  from random import random
  
  class generate_random_no:
      def __init__(self):
          #rand = random()
          pass
      def get_random_number(self):
          return randint()
  
      def get_random_number(self, upperbound):
          return randrange(upperbound)
  </code></pre>