On Oct 17, 10:43 am, Vince <[EMAIL PROTECTED]> wrote:
> I tried to do like this, considering the plugin helloworld. I created
> a folder "lib" like this HelloWorld/helloworld-plugin/helloworld/lib
> and I put myfile.py inside it. This file contain a class, named
> "Myclass".
> Then, in the file HelloWorld/helloworld-plugin/helloworld/
> helloworld.py I added "from helloworld.lib import myfile" at the begin
> of the file.
> Finally I added the line      "                            'htdocs/lib/
> *.py', " in the file HelloWorld/helloworld-plugin/setup.py
>
> And I have this  error :
> Error: Not Found          No handler matched request to /helloworld
>
> I guess the import is not done well. Do you know how can I do that
> please ?
> Vincent

If you turn on debug logging (http://trac.edgewall.org/wiki/
TracLogging), it will likely there contain an entry that the plugin
couldn't be loaded due to error.

If you are importing from the same level with current Python releases,
you need to use relative paths - not absolute. Absolute is for paths
that cannot be resolved relative to the current file. So you want
either:
from lib.myfile import * # everything in it can be used directly ie.
myfunction()
from lib.myfile import MyClass, my_function # picking particular
attributes
import lib.myfile # then need to use full namespace in use
lib.myfile.myfunction()

This is all Python know-how, and I suggest you look at the free online
"Dive into Python" book for an introduction. Google for it.

You might also want to get on the IRC channel (http://
trac.edgewall.org/wiki/IrcChannel) - handy for getting quick answers
for code details and development.

Please check it out and keep at it - new plugin developers are very
welcome!


:::simon
https://www.coderesort.com




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to