1

EDIT: The exact code is on GitHub at https://github.com/edbrannin/mkdocs/tree/windows-runnable and it also fails on Linux.


I'm trying to make the script installation for mkdocs cross-platform by using the entry_points argument to setup():

entry_points={ 'console_scripts': [ 'mkdocs = mkdocs.mkdocs:main_entry_point', ], },

The output from python setup.py install is here.

Running python setup.py install produces c:\Python27\lib\site-packages\mkdocs and this file in c:\Python27\Scripts\mkdocs-script.py:

#!C:\Python27\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'mkdocs==0.9','console_scripts','mkdocs'
__requires__ = 'mkdocs==0.9'
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
    sys.exit(
        load_entry_point('mkdocs==0.9', 'console_scripts', 'mkdocs')()
    )

When I try to run mkdocs, it says it can't find the module:

C:\>mkdocs Traceback (most recent call last): File "C:\Python27\Scripts\mkdocs-script.py", line 9, in <module> load_entry_point('mkdocs==0.9', 'console_scripts', 'mkdocs')() File "C:\Python27\lib\site-packages\distribute-0.6.34-py2.7.egg\pkg_resources.py", line 343, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "C:\Python27\lib\site-packages\distribute-0.6.34-py2.7.egg\pkg_resources.py", line 2307, in load_entry_point return ep.load() File "C:\Python27\lib\site-packages\distribute-0.6.34-py2.7.egg\pkg_resources.py", line 2013, in load entry = __import__(self.module_name, globals(),globals(), ['__name__']) ImportError: No module named mkdocs

...but it's clearly there:

C:\>python
Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import mkdocs
>>> 

Any idea what I'm doing wrong?

4
  • I would try updating distribute in your system, you seem to have older version installed. Not sure it would help, but there is some chance. Commented Jun 5, 2014 at 18:43
  • I just tried that; no dice. Commented Jun 6, 2014 at 13:57
  • Did you update to a new version of setuptools, or remain with distribute? You should probably do the former. Commented Jun 6, 2014 at 20:21
  • Also, you might want to include the contents of mkdocs' egg-info directory. An odd thought - is there a mkdocs.py script in C:\Python27\Scripts? That might mess things up... Commented Jun 6, 2014 at 20:24

1 Answer 1

2

Your script location does indeed not exist. Your setup.py specifies mkdocs.mkdocs. main_entry_point, but that is not importable. You can check this you in your python shell:

>>> from mkdocs.mkdocs import main_entry_point

This will result in an import error. This happens because of a file naming error: if you rename mkdocs/mkdocs to mkdocs/mkdocs.py you should see things start working.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for answering here too! I hadn't paid much attention to the missing extension because it was originally a scripts=[...] file like "bin/mkdocs" and I was trying to change as little as possible with my first pull-request on that project.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.