Directory

G

gtillmon

Hello. I am new to the Python language.
I would like to know how to display and store the path of each mondule
that is called.
Similar to the old READY TRACE in COBOL of long ago.

Thanks,
George
 
S

Steve Holden

gtillmon said:
Hello. I am new to the Python language.
I would like to know how to display and store the path of each mondule
that is called.

Modules are imported, not called.
Similar to the old READY TRACE in COBOL of long ago.
It's certainly possible to trace function calls, if that would help.
sys.settrace allows you to establish a function that gets called
whenever a Python function call is executed. The documentation is a
little sparse, but you can find a rough example under "Crude Python
Debugging" in

http://www.st.ewi.tudelft.nl/~mol/snippets.php

regards
Steve
 
G

Gabriel Genellina

gtillmon wrote:
It's certainly possible to trace function calls, if that would help.
sys.settrace allows you to establish a function that gets called

If the OP is only interested in import statements, perhaps the -v flag is
enough:

python -v script_name.py

It prints a line (on stderr) for each module imported, stating its name
and source file.
 
G

gtillmon

If the OP is only interested in import statements, perhaps the -v flag is  
enough:

python -v script_name.py

It prints a line (on stderr) for each module imported, stating its name  
and source file.

Thanks for the information.
 
G

gtillmon

Modules are imported, not called.


It's certainly possible to trace function calls, if that would help.
sys.settrace allows you to establish a function that gets called
whenever a Python function call is executed. The documentation is a
little sparse, but you can find a rough example under "Crude Python
Debugging" in

 http://www.st.ewi.tudelft.nl/~mol/snippets.php

regards
 Steve


Thanks for the information.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,298
Messages
2,571,539
Members
48,274
Latest member
HowardKipp

Latest Threads

Top