Reputation: 243
I am using sublime-text 2 for python and wanted to import a folder as a module. I put an __init__.py
inside the folder with contents as:
__all__=["imsave2","model_io","load_data","utils"];
where "imsave2","model_io","load_data","utils"
are .py
files inside the folder.
This arrangement works when using the python shell. To make the folder importable in sublime-text -2 I edited user settings
by adding:
"default_extend_env":
{
"PYTHONPATH": "/home/abc/vision/Datasets:/home/abc/vision/code"
},
"env":
{
"PYTHONPATH": "/home/abc/vision/Datasets:/home/abc/vision/code"
},
where the folder/module I want to import is /home/abc/vision/code/module1
. However sublime-text2 still can't see my module.
Upvotes: 1
Views: 114
Reputation: 1
I have a similar problem with sublime text and python modules. In my case it worked as follow: In terminal, install your python module, pycountry in my case
install pip module
After that install in Sublime Text the python you are running. As default it is in Automatic. Install the python you are running and select in
'Tools -> Command Palete -> Package Control: Install Package'
Once I did pycountry module works!
Upvotes: 0