Import module from python shell works, from a python script doesn't

Oct 22, 2014 at 1:31 AM
Hi, i'm not sure why this is happening:

C:\Users\Alessio
λ C:\Python27\python.exe Documents\azure\azure.py
Traceback (most recent call last):
File "Documents\azure\azure.py", line 2, in <module>
import azure                                                                                    
File "C:\Users\Alessio\Documents\azure\azure.py", line 3, in <module>
import azure.servicemanagement                                                                  
ImportError: No module named servicemanagement

C:\Users\Alessio
λ python
Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import azure
import azure.servicemanagement
exit()
I'm missing to configure some env variable?
Coordinator
Oct 22, 2014 at 1:42 AM
Because your script is called azure.py, it itself becomes a module named "azure", shadowing the actual azure package that you're trying to import. You should give it some other name, e.g. main.py.
Oct 22, 2014 at 9:38 AM
I've realized after posting the thread :(
Thank you for pointing that out, much appreciated!
Nov 28, 2014 at 6:26 PM
test