[Pkg-utopia-maintainers] Bug#559547: __init__.pys present on my system

Joseph Spiros joseph at josephspiros.com
Mon Dec 7 03:16:37 UTC 2009


Yes, it is line 23 that fails. I reverted my find+touch "fix", purged,
ensured that /usr/lib/pymodules/python2.5/coherence and
/usr/share/pyshared/coherence no longer existed before reinstalling the
python-coherence package to obtain this log:

> $ coherence
> Traceback (most recent call last):
>   File "/usr/bin/coherence", line 23, in <module>
>     from coherence.extern.simple_config import Config,ConfigItem
> ImportError: No module named extern.simple_config
> $ python
> Python 2.5.4 (r254:67916, Nov 19 2009, 19:46:21) 
> [GCC 4.3.4] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from coherence.extern.simple_config import Config,ConfigItem
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: No module named extern.simple_config
>>>> import coherence.extern
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: No module named extern
>>>> import coherence.extern.simple_config
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: No module named extern.simple_config

When I take a look at sys.path, it contains
/usr/lib/pymodules/python2.5, but does not contain /usr/share/pyshared.
Do you have an __init__.py file in
/usr/lib/pymodules/python2.5/coherence/extern?

Following up from the log above, this perhaps illustrates how I've fixed
this problem (albeit temporarily) on my system:

> jspiros at hylia:~$ sudo touch /usr/lib/pymodules/python2.5/coherence/extern/__init__.py
> jspiros at hylia:~$ coherence
> /usr/lib/python2.5/site-packages/zope/__init__.py:3: UserWarning: Module coherence was already imported from /usr/lib/pymodules/python2.5/coherence/__init__.py, but /usr/lib/pymodules/python2.5 is being added to sys.path
>   import pkg_resources
> Traceback (most recent call last):
>   File "/usr/lib/python2.5/site-packages/twisted/internet/base.py", line 374, in fireEvent
>     DeferredList(beforeResults).addCallback(self._continueFiring)
>   File "/usr/lib/python2.5/site-packages/twisted/internet/defer.py", line 195, in addCallback
>     callbackKeywords=kw)
>   File "/usr/lib/python2.5/site-packages/twisted/internet/defer.py", line 186, in addCallbacks
>     self._runCallbacks()
>   File "/usr/lib/python2.5/site-packages/twisted/internet/defer.py", line 328, in _runCallbacks
>     self.result = callback(self.result, *args, **kw)
> --- <exception caught here> ---
>   File "/usr/lib/python2.5/site-packages/twisted/internet/base.py", line 387, in _continueFiring
>     callable(*args, **kwargs)
>   File "/usr/bin/coherence", line 249, in main
>     from coherence.base import Coherence
>   File "/usr/lib/pymodules/python2.5/coherence/base.py", line 21, in <module>
>     from coherence.upnp.core.ssdp import SSDPServer
> exceptions.ImportError: No module named upnp.core.ssdp
> ^C
> jspiros at hylia:~$ sudo find /usr/lib/pymodules/python2.5/coherence -type d -exec touch {}/__init__.py \;
> jspiros at hylia:~$ coherence
> /usr/lib/python2.5/site-packages/zope/__init__.py:3: UserWarning: Module coherence was already imported from /usr/lib/pymodules/python2.5/coherence/__init__.py, but /usr/lib/pymodules/python2.5 is being added to sys.path
>   import pkg_resources

As you can see, the non-existence of __init__.py in various packages
within python-coherence is causing problems with running coherence(1).
This behavior seems to be consistent with Python documentation.

All this said, I have no idea how Debian handles Python-related
packages. I don't even know where /usr/lib/pymodules comes from, or how
it's related to /usr/share/pyshared.

On 12/6/09 5:07 PM, Matt Kraai wrote:
> On Sun, Dec 06, 2009 at 01:41:50PM -0500, Joseph Spiros wrote:
>> Same here.
>>
>> $ dpkg -L python-coherence | grep /__init__\\.py\$
>> /usr/share/pyshared/coherence/upnp/core/test/__init__.py
>> /usr/share/pyshared/coherence/extern/louie/__init__.py
>> /usr/share/pyshared/coherence/extern/galleryremote/__init__.py
>> /usr/share/pyshared/coherence/extern/youtubedl/__init__.py
>> /usr/share/pyshared/coherence/__init__.py
>>
>> However, __init__.py files are missing in many of the other
>> subdirectories of /usr/share/pyshared/coherence, which causes those
>> directories to not be seen as packages/modules.
>>
>> For example, /usr/share/pyshared/coherence/extern/__init__.py does not
>> exist. It does exist in the current trunk of the coherence project, and
>> needs to exists to allow coherence(1) to import extern.simple_config.
> 
> No, I can run coherence and also a script that just contains
> 
>  import coherence.extern.simple_config
> 
> on my system.  Line 23 of /usr/bin/coherence on my system contains
> 
>  from coherence.extern.simple_config import Config,ConfigItem
> 
> Is this also the case on your system?  Is this the line that's causing
> the exception?
> 

-- 
Joseph Spiros
joseph at josephspiros.com
+1 (440) 707-6855






More information about the Pkg-utopia-maintainers mailing list