~/talk

Watch your Python script with strace

Talkat PyOhio 2014 · 2014-07-26..07-27· [linux-and-operating-systems, python]
links:none on file
slides:none on file

Shows how to use strace/truss to observe actual system calls made by Python and why that matters: /bin/true makes a few dozen calls, an empty Python -c script makes 57 system calls, importing a module can be hundreds (378) and importing large packages in a polluted path can spike to 73,000 syscalls. Demonstrates options (-o trace.txt, -f to follow children), explains buffering hiding writes, recommends comparing a working trace, and recommends ltrace to inspect library calls (useful for SSL plaintext debugging).

AI-written summary · about

  1. 0:00Introduction
  2. 10:56Standard error and exit
  3. 17:13Tracing a simple command
  4. 17:55C runtime initialization
  5. 19:13System call analysis
  6. 24:30Dynamic library loading
  7. 26:14System call noise
  8. 26:28Python startup behavior
  9. 26:55Python module search
  10. 27:57Import system calls
  11. 31:17Virtual environments
  12. 31:44Easy install vs pip
  13. 32:05Buildout impact
  14. 32:15Sys.path issues
  15. 32:48Importing libraries
  16. 34:31N-squared complexity
  17. 34:49Dependency management
  18. 35:00Python 3 optimizations
  19. 37:35Debugging imports
  20. 42:07System call mapping
  21. 43:18DNS and sockets
  22. 43:32Man pages and buffering
  23. 48:00Process termination
  24. 48:39Threading and children
  25. 49:01Subprocess management
  26. 49:28Debugging strategies
  27. 51:21Ltrace for libraries
  28. 51:48Conclusion
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.