Quantcast

sys.path missing tracker subdirs when running extensions

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

sys.path missing tracker subdirs when running extensions

John P. Rouillard

Hi all:

I came across a bit of a weirdness. I know how to fix it but it still
seems strange.

I have a file in [tracker_home]/extensions called templating.py.  It
is full of functions that I call from templates. One of the functions
is called AboutPage() that is registered as a utility function.

In there I have two places I print sys.path.

One occurs when the module is loaded. Here is the debug output from
the logging module:
 
2017-03-02 18:35:05 (name)s:templating.<module>,DEBUG: path is: [
   '/home/rouilj/develop/roundup.sysadmin',
   '/home/rouilj/develop/roundup.sysadmin/demo/lib',
   '/home/rouilj/develop/roundup.sysadmin/demo/extensions',
   '/home/rouilj/develop/roundup.sysadmin/roundup/scripts',
   '/usr/lib/python2.7',
   '/usr/lib/python2.7/plat-x86_64-linux-gnu',
   '/usr/lib/python2.7/lib-tk',
   '/usr/lib/python2.7/lib-old',
   '/usr/lib/python2.7/lib-dynload',
   '/usr/local/lib/python2.7/dist-packages',
   '/usr/lib/python2.7/dist-packages',
   '/usr/lib/python2.7/dist-packages/PILcompat',
   '/usr/lib/python2.7/dist-packages/gtk-2.0',
   '/usr/lib/pymodules/python2.7',
   '/usr/lib/python2.7/dist-packages/ubuntu-sso-client']

The second print occurs inside the AboutPage() function:

2017-03-02 23:35:08 (name)s:templating.AboutPage, DEBUG: path is: [
   '/home/rouilj/develop/roundup.sysadmin',
   '/home/rouilj/develop/roundup.sysadmin/roundup/scripts',
   '/usr/lib/python2.7',
   '/usr/lib/python2.7/plat-x86_64-linux-gnu',
   '/usr/lib/python2.7/lib-tk',
   '/usr/lib/python2.7/lib-old',
   '/usr/lib/python2.7/lib-dynload',
   '/usr/local/lib/python2.7/dist-packages',
   '/usr/lib/python2.7/dist-packages',
   '/usr/lib/python2.7/dist-packages/PILcompat',
   '/usr/lib/python2.7/dist-packages/gtk-2.0',
   '/usr/lib/pymodules/python2.7',
   '/usr/lib/python2.7/dist-packages/ubuntu-sso-client']

Note the second case is missing all the paths that include the demo
tracker.

The command I am using to run this is:

  python roundup/scripts/roundup_server.py -l run.log -p 8917 demo=demo

Any idea why sys.path is kind of broken in the second case?

It kind of breaks the ability to import modules from the library
(demo/lib) from functions inside the extensions directory.

I was able to fix my problem by importing the module at the
module/file level, but that pollutes the file's namespace.

Any quips, thought or comments?

--
                                -- rouilj
John Rouillard
===========================================================================
My employers don't acknowledge my existence much less my opinions.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Roundup-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/roundup-devel
Loading...