Cannot import module in new plugin

Asked by Nicolas Chachereau on 2011-07-10

I'm trying to create a Kupfer plugin for the Hamster Time Tracking applet [1].

In order to avoid recreating a client class doing the D-Bus messaging, I wanted to import a module already existing in Hamster. However, I can't import this client class into my Kupfer plugin which fails because of this [2].

However, it works perfectly inside Python [3], which means Kupfer's custom import somehow restricts valid imports. Is this a feature (i.e. wanted behaviour) or a bug? If it isn't a bug, why can't I import this file, and what can I do instead? Do I really need to rewrite my own client class?

[1]: http://projecthamster.wordpress.com/
[2]: http://paste2.org/p/1512498
[3]: http://paste2.org/p/1512500

Question information

Language:
English Edit question
Status:
Solved
For:
kupfer Edit question
Assignee:
No assignee Edit question
Solved by:
Karol Będkowski
Solved:
2011-07-10
Last query:
2011-07-10
Last reply:
2011-07-10

Your plugin also have name "hamster" so importing "client" from "hamster" you try to import client from plugin module.
Simplest solution - please rename your plugin to - in example - "hamster_client.py"

Thanks Karol Będkowski, that solved my question.

Thanks a lot, that should have been obvious. My python skills are obviously rusty!

teranex (teranex) said : #4

Would it be possible to post the code somewhere online? I'm interested in this plugin, but the links to paste2.org are not valid anymore... Thx!