script names that are same as top-level package do not work on windows
Ran into a problem with setuptools 0.6a5 on Windows where a console_script is named the same as a top-level package. This problem doesn't occur on Linux, presumably because the installed script does not have a .py extension to confuse the import of a same-named package. Excerpt from setup.py: entry_points = { 'console_scripts': ['schevo = schevo.script.main:start'], } Traceback on Windows when running the installed schevo.exe: Traceback (most recent call last): File "c:\python24\scripts\schevo.py", line 7, in ? sys.exit( File "c:\python24\lib\site-packages\setuptools- 0.6a5-py2.4.egg\pkg_resources.p y", line 236, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "c:\python24\lib\site-packages\setuptools- 0.6a5-py2.4.egg\pkg_resources.p y", line 1892, in load_entry_point return ep.load() File "c:\python24\lib\site-packages\setuptools- 0.6a5-py2.4.egg\pkg_resources.p y", line 1625, in load entry = __import__(self.module_name, globals(),globals(), ['__name__']) File "c:\python24\scripts\schevo.py", line 7, in ? sys.exit( File "c:\python24\lib\site-packages\setuptools- 0.6a5-py2.4.egg\pkg_resources.p y", line 236, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "c:\python24\lib\site-packages\setuptools- 0.6a5-py2.4.egg\pkg_resources.p y", line 1892, in load_entry_point return ep.load() File "c:\python24\lib\site-packages\setuptools- 0.6a5-py2.4.egg\pkg_resources.p y", line 1625, in load entry = __import__(self.module_name, globals(),globals(), ['__name__']) ImportError: No module named script.main Thanks, -- Matthew R. Scott
At 07:28 PM 9/30/2005 -0500, Matthew Scott wrote:
Ran into a problem with setuptools 0.6a5 on Windows where a console_script is named the same as a top-level package.
Hm. Are you installing scripts and modules to the same directory? Usually those are two different directories on Windows (i.e., site-packages and Scripts) Come to think of it, that wouldn't actually help this problem. I'll have to use some other extension for the files, I guess. It's just that I was using .py and .pyw for console and GUI so that people used to running scripts the "old" way wouldn't be surprised. I guess I could just drop the extensions altogether, but that's going to leave the old files behind. (We really need an uninstaller for scripts.) Another possibility would be to add '-script.py' so that it's e.g. 'schevo.exe' and 'schevo-script.py'. That way, if somebody needed it to be a .py file, it'd be there, but it's not an importable name, so it couldn't clash with any modules or packages. Thoughts, anyone?
On 9/30/05, Phillip J. Eby <pje@telecommunity.com> wrote:
At 07:28 PM 9/30/2005 -0500, Matthew Scott wrote:
Ran into a problem with setuptools 0.6a5 on Windows where a console_script is named the same as a top-level package.
No "rush order" to fix this by the way (at least not from me :) -- we opted to use a differently-named script. -- Matthew R. Scott
participants (2)
-
Matthew Scott
-
Phillip J. Eby