[pyar] saber que script invoca la clase

Emiliano Dalla Verde Marcozzi edvm en airtrack.com.ar
Mar Feb 8 11:35:57 ART 2011


El 8 de febrero de 2011 11:05, Gerardo Herzig <gherzig en fmed.uba.ar>escribió:

>
> Yo quiero que si hago un programa /bin/pepito.py, y ahi hago un
> import db.DB
> conexion = DB().open()
>
> yo pueda agregar un logging al modulo db.py para que logguee, entre
> otras cosas, que quien lo invoco fue /bin/pepito.py, mas cualquier otra
> informacion de depuracion que tenga ganas de poner.
>
>
Algo asi? ...

bash-4.1$
~/libexec/py27/bin/python

Python 2.7.1 (r271:86832, Nov 29 2010,
21:17:43)

[GCC 4.4.4] on
linux2

Type "help", "copyright", "credits" or "license" for more
information.

>>> import
db

/home/lain/libexec/py27/bin/python
>>>
bash-4.1$ python
Python 2.7.1 (r271:86832, Jan 25 2011, 09:35:25)
[GCC 4.4.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import db
/usr/local/bin/python
>>>
bash-4.1$ cat db.py
import sys

print sys.executable



-- 
*Emiliano Dalla Verde Marcozzi*
Encargado de IT y Python Ninja Developer



San Juan 4879
Rosario. Argentina
Tel. (+54) 341 437 6878
www.airtrack.com.ar

"Chuck Norris doesn't need a debugger, he just stares down the bug until the
code confesses."
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://listas.python.org.ar/pipermail/pyar/attachments/20110208/b1203750/attachment.html>


More information about the pyar mailing list