You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Potential conflict with site from the standard lib #878
It took me quite some time to figure out why after a mkdocs build my virtualenv and even my whole python install were broken. It appears that the generated documentation is by default within the site directory and it conflicts with the site module from the standard lib that is quite important to run python (to say the least :) ).
I'm not sure how to fix that except building in another default directory, a new clean install of my venv + new build resolve the issue. If you encounter the same issue, the command python2.7 -c "import site; print site.__file__" may help you understand what's going on.
The __init__.py files are required to make Python treat the directories as containing packages; this is done to prevent directories with a common name, such as string, from unintentionally hiding valid modules that occur later on the module search path.
In fact, I just tried it and, with a site directory built by MkDocs, I can import site just fine as my site directory does not contain an __init__.py file. Does yours?
If this is unavoidable on your system (either you have a legitimate need for a __init__.py file in your site dir or you have a weird system config), you can always change the name of the site_dir in your mkdocs.yml config file:
Activity
waylan commentedon Mar 30, 2016
As the Python docs state:
In fact, I just tried it and, with a
sitedirectory built by MkDocs, I canimport sitejust fine as mysitedirectory does not contain an__init__.pyfile. Does yours?If this is unavoidable on your system (either you have a legitimate need for a
__init__.pyfile in yoursitedir or you have a weird system config), you can always change the name of thesite_dirin yourmkdocs.ymlconfig file:davidbgk commentedon Mar 30, 2016
Yes, the
mkdocs buildstep generates a__init__.pyfile in mysitedirectory.waylan commentedon Mar 30, 2016
Oh, I just remembered #807. This is a duplicate so I'm closing it..
davidbgk commentedon Mar 30, 2016
I missed that one, thanks and sorry for the noise!