aacanakin / glim

a modern python framework for the web

Home Page:http://glim.readme.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ImportError when running `glim new`

rubik opened this issue · comments

I installed glim via pip and when I run glim new I got this ImportError:

File exp/lib/python3.4/site-packages/glim/cli.py, line 16, in <module>
    import paths
ImportError: No module named 'paths'

I believe it should be import glim.paths?

EDIT: Ok, after changing it a SyntaxError appeared because Glim is not compatible with Python 3 (which I'm using right now). Would you be interested in a pull request to make Glim Python 3 compatible and PEP8 compliant (e.g. spaces in place of tabs, etc.)?

Hi,
The code automatically detects if the project is running from pypi or not. glim/cli.py module can pop and insert a new sys path to the python environment. However, I couldn't be able to reproduce this error. Could it be because of you're using python 3 ?

A PEP8 python 3 compatible pull request would be awesome for me.

Btw, did you run glim new on the same folder with virtualenv ?

Nope, these are the steps I followed:

$ virtualenv exp
$ cd exp
$ source bin/activate
$ pip install glim
$ mkdir app
$ cd app
$ glim new

The real difference here from documentation is that you want to create inside virtualenv folder. When you do that, the sys path is getting messed up. Try the following:

$ virtualenv exp
$ . exp/bin/activate
$ glim new # it already creates app folder. 
$ cp app/config/default.py app/config/development.py
$ glim start

Yes, that way it works. But I don't understand why paths is imported instead of glim.paths.

The main reason why import paths works is because when you type glim from command line, it runs glim/cli.py and in that module, there exists paths module. However, after paths.configure() function is called the sys path becomes the root path of project folder. When the sys path becomes project root, import glim.paths is available.

So, if you're really not required to put app folder inside virtualenv, then I will close this.

Ok, I understand, it makes sense.