DAGDA SEARCH | Back to results | Support

Issue 35595: Add sys flag to always show full paths in stack traces (instead of relative paths) - Python tracker

Source: https://bugs.python.org/issue35595

homepage

Issue35595 ➜

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Created on 2018-12-27 15:50 by Scott Arciszewski, last changed 2022-04-11 14:59 by admin.

Messages (2)
msg332593 - (view) Author: Scott Arciszewski (Scott Arciszewski) Date: 2018-12-27 15:50
I have a wsgi script writing to a log file. The contents look like this (truncated):

  File "build/bdist.linux-x86_64/egg/trac/ticket/query.py", line 284, in _count
    % sql, args)[0][0]
  File "build/bdist.linux-x86_64/egg/trac/db/api.py", line 122, in execute
    return db.execute(query, params)
  File "build/bdist.linux-x86_64/egg/trac/db/util.py", line 128, in execute
    cursor.execute(query, params if params is not None else [])

When confronted with this logfile, I have no idea where build/bdist.linux-x86_64 lives. Rather than hoping a well-timed lsof is adequate to catch the actual script path, I'd like to be able to set a sys.flag to always log the real, fullpath of the .py script either instead of, or alongside, the file path.
msg332622 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2018-12-27 21:51
Python 2.7 is (almost) end of life and well beyond feature-freeze, so this can only go into 3.8 or better.

Since the paths logged are relative to the current working directory, perhaps you could just have your script log the working directory?
History
Date User Action Args
2022-04-11 14:59:09adminsetgithub: 79776
2018-12-28 12:05:04xtreaksetnosy: + xtreak
2018-12-27 21:51:48steven.dapranosetversions: - Python 2.7
nosy: + steven.daprano

messages: + msg332622

type: enhancement
2018-12-27 15:50:03Scott Arciszewskicreate
Supported by The Python Software Foundation,
Powered by Roundup Copyright © 1990-2022, Python Software Foundation
Legal Statements