importing modules from alternate path
I'm trying with no succes to load modules from an alternate path. When installing to default location (no --home specifed) everything works as expected. $ python setup.py install --home=~ running install running build running build_ext running install_lib running install_egg_info Removing /home/voodoo/lib/python/PackageName-1.0-py2.6.egg-info Writing /home/voodoo/lib/python/PackageName-1.0-py2.6.egg-info $ printf "import demo" | PYTHONPATH=~ python Traceback (most recent call last): File "", line 1, in ImportError: No module named demo $ printf "import demo" | PYTHONHOME=~ python Traceback (most recent call last): File "", line 1, in ImportError: No module named demo Any idea why alternate path is not working? - BEGIN OF setup.py from distutils.core import setup, Extension module1 = Extension('demo', sources = ['demo.c']) setup (name = 'PackageName', version = '1.0', description = 'This is a demo package', ext_modules = [module1]) - END OF end setup.py - BEGIN OF demo.c #include static PyObject* demo_bla(PyObject *self) { return Py_BuildValue("i", 666); } - END OF demo.c -- http://mail.python.org/mailman/listinfo/python-list
how to use logging.config.fileConfig ?
Hello, I have a problem using logging the library. I copied and modified the example from PEP 282 [0], [1], [2], [3]. If I use logging.basicConfig() everything works fine. If I use logging.config.fileConfig() my loggers get disabled. I checked logging/ config.py and I found a big comment saying that old loggers are disabled! Why? What am I doing wrong? How do I use logging.config.fileConfig() to avoid this problem ? with logging.config.fileconfig() 2009-04-10 17:49:19,955:MyApp:INFO - Starting my app 2009-04-10 17:49:19,955:MyApp:ERROR - There was a problem. Traceback (most recent call last): File "myapp.py", line 10, in mymodule.doIt() File "/home/voodoo/src/mymodule.py", line 7, in doIt raise TypeError, "Bogus type error for testing" TypeError: Bogus type error for testing 2009-04-10 17:49:19,956:MyApp:INFO - Ending my app -- with logging.basicConfig() -- INFO:MyApp:Starting my app DEBUG:MyModule:Doin' stuff... ERROR:MyApp:There was a problem. Traceback (most recent call last): File "myapp.py", line 10, in mymodule.doIt() File "/home/voodoo/src/mymodule.py", line 7, in doIt raise TypeError, "Bogus type error for testing" TypeError: Bogus type error for testing INFO:MyApp:Ending my app -- [0] http://rafb.net/p/nl7b7m19.html [1] http://rafb.net/p/n6KNdU44.html [2] http://rafb.net/p/OxyTga98.html [3] http://www.python.org/dev/peps/pep-0282/ -- http://mail.python.org/mailman/listinfo/python-list
derived classes and __getattr__
i'm facing the following problem: class Base(object): def __getattr__(self, attr): return lambda x: attr + '_' + x def dec(callable): return lambda *args: 'dec_' + callable(*args) class Derived(Base): what_so_ever = dec(Base.what_so_ever) # wrong, base doesn't have what_so_ever mumu = dec(Base.mumu) # wrong, base doesn't have mumu any idea how to do this? -- http://mail.python.org/mailman/listinfo/python-list