[Develop] Question: How to "import app"

Marian Dubiel mail at marian-dubiel.de
Wed Dec 19 14:48:49 EST 2007


Hi everybody,

it would be nice if someone could help me with a problem I have.

I want to implement remote control in miro with lirc. Therefore I use 
pylirc to get the commands from my remote.
Because I don't wanna spend much time on it, I followed a quick and 
dirty approach and hacked the necessary code into the "eventloop.py" 
(because pylirc uses polling to retrieve the commands from the remote 
and by using "Eventloop.loop()", I don't have to write my own loop In a 
seperate thread).

This works fine so far, I get the commands from my remote control. Now I 
want to execute the right commands, so I looked into "keyboard.py" and 
found the necessary methods like 
"app.controller.playbackController.playPause()".
To use these methods however, I have to import "app".
If I add the statement "import app" to the import statements in the 
"eventloop.py" file I get this stack trace when starting up miro:

----------------------------------  SNIPPET  
----------------------------------
Traceback (most recent call last):
  File "/usr/bin/miro.real", line 24, in <module>
    import gtcache
  File "/var/lib/python-support/python2.5/miro/gtcache.py", line 22, in 
<module>
    import config
  File "/var/lib/python-support/python2.5/miro/config.py", line 25, in 
<module>
    import eventloop
  File "/var/lib/python-support/python2.5/miro/eventloop.py", line 28, 
in <module>
    import app
  File "/var/lib/python-support/python2.5/miro/app.py", line 24, in <module>
    import views
  File "/var/lib/python-support/python2.5/miro/views.py", line 19, in 
<module>
    import feed
  File "/var/lib/python-support/python2.5/miro/feed.py", line 20, in 
<module>
    from item import *
  File "/var/lib/python-support/python2.5/miro/item.py", line 20, in 
<module>
    from gtcache import gettext as _
ImportError: cannot import name gettext
-------------------------------------------------------------------------

Unfortunately, I am not familiar with python at all, so I have no idea 
if the error occurres because of a restriction in the architecture of 
miro or if this is a "problem" with python (maybe I have to use the 
import statement in another way).
Several other files import app, so why does that not work in 
eventloop.py. Is there another way to get the object I need for 
controlling the player?

Thank you for reading my request and I thank you all for this cool 
application.

Best regards

Marian Dubiel


More information about the Develop mailing list