Skip to content

Potential conflict with site from the standard lib #878

Closed

Description

@davidbgk

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.

Activity

  1. waylan commented on Mar 30, 2016

    @waylan
    Contributor

    As the Python docs state:

    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:

    site_dir: somethingthatisnotsite
  2. davidbgk commented on Mar 30, 2016

    @davidbgk
    Author

    Does yours?

    Yes, the mkdocs build step generates a __init__.py file in my site directory.

  3. waylan commented on Mar 30, 2016

    @waylan
    Contributor

    Oh, I just remembered #807. This is a duplicate so I'm closing it..

  4. davidbgk commented on Mar 30, 2016

    @davidbgk
    Author

    I missed that one, thanks and sorry for the noise!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions