Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Seems a __init__.py is needed in src/ directory? #105

Closed
radaiming opened this Issue · 3 comments

2 participants

@radaiming

According to the python doc, there seems should be a init.py file in src/ directory. Before I touch a blank init.py I got the error:

$ ./you-get
Traceback (most recent call last):
File "./you-get", line 3, in
from src.you_get import main
ImportError: No module named src.you_get

@soimort
Owner

Interesting. in my Python 3.3.0, it is allowed not having a __init__.py in src/
however, src should not be considered as a package. the most-top-level namespace is you_get. I will change that soon.

you-get:

#!/usr/bin/env python3

import os, sys
sys.path.insert(0, os.path.join((os.path.dirname(os.path.abspath(__file__))), "src"))

from you_get import *

if __name__ == "__main__":
    main()
@soimort soimort closed this in 106c85e
@radaiming

My python3 version is 3.2.3

@radaiming

I suggest using os.path.realpath(file) instead of os.path.abspath(file), I usually use a symbolic link in /usr/local/bin to point to you-get, if use os.path.abspath(file), I'll got /usr/local/bin/src in sys.path. I checked posixpath.py, the realpath() will always call abspath() to get absolute path before returning the real path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.