Hi, Sorry but I tried so many times, and it still does not work. I have the same configuration. I just move my folder "lib" in the folder htdocs. Then I tried from lib.myfile import *, from helloworld.lib.myfile import *, or: from lib.myfile import MyClass The error remains the same.
I don't have any problems to import other module, it's just for my file .py that I cannot. If I have no response I will go on IRC. Thanks, Vincent On Oct 17, 11:40 pm, osimons <[EMAIL PROTECTED]> wrote: > 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! > > :::simonhttps://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 -~----------~----~----~----~------~----~------~--~---
