Mar-27-2018, 01:23 AM
I know this is a basic question, and trust me, I have exhausted other resources and it still won't work.
I am unable to import any modules when running my python file when I execute my python file through Sublime Text, but I am able to when I interact with python.py via cmd prompt. I am not sure what has gone wrong. I have appended the sys.path to include my current directory and it still does not work. Below is my code:
import sys
sys.path.append('\Users\b\Box Sync\Desktop\Projects\Coding\pythonlessons')
print sys.path
import things
Below is my output:
C:\Users\b\Box Sync\Desktop\Projects\Coding\pythonlessons>testfile.py
['C:\\Users\\b\\Box Sync\\Desktop\\Projects\\Coding\\pythonlessons', 'C:\\Users\\b\\Box Sync\\Desktop\\Projects\\Coding\\pythonlessons', 'C:\\WINDOWS\\SYSTEM32\\python27.zip', 'C:\\Python27\\DLLs', 'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27', 'C:\\Python27\\lib\\site-packages', '\\Users\x08\\Box Sync\\Desktop\\Projects\\Coding\\pythonlessons']
Traceback (most recent call last):
File "C:\Users\b\Box Sync\Desktop\Projects\Coding\pythonlessons\testfile.py", line 6, in <module>
import things
ImportError: No module named things
The same thing happens for numpy or anything else. I would greatly appreciate your input.
Thank you,
In addition, since my python.py file works, I thought I could create a .py file in a different directory like C:\Python27 and see if I could access a module and the same reply comes up when I execute it.
I am unable to import any modules when running my python file when I execute my python file through Sublime Text, but I am able to when I interact with python.py via cmd prompt. I am not sure what has gone wrong. I have appended the sys.path to include my current directory and it still does not work. Below is my code:
import sys
sys.path.append('\Users\b\Box Sync\Desktop\Projects\Coding\pythonlessons')
print sys.path
import things
Below is my output:
C:\Users\b\Box Sync\Desktop\Projects\Coding\pythonlessons>testfile.py
['C:\\Users\\b\\Box Sync\\Desktop\\Projects\\Coding\\pythonlessons', 'C:\\Users\\b\\Box Sync\\Desktop\\Projects\\Coding\\pythonlessons', 'C:\\WINDOWS\\SYSTEM32\\python27.zip', 'C:\\Python27\\DLLs', 'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27', 'C:\\Python27\\lib\\site-packages', '\\Users\x08\\Box Sync\\Desktop\\Projects\\Coding\\pythonlessons']
Traceback (most recent call last):
File "C:\Users\b\Box Sync\Desktop\Projects\Coding\pythonlessons\testfile.py", line 6, in <module>
import things
ImportError: No module named things
The same thing happens for numpy or anything else. I would greatly appreciate your input.
Thank you,
In addition, since my python.py file works, I thought I could create a .py file in a different directory like C:\Python27 and see if I could access a module and the same reply comes up when I execute it.