Thanks to mcandre, the answer is:
#python3
from inspect import currentframe, getframeinfo
frameinfo = getframeinfo(currentframe())
print(frameinfo.filename, frameinfo.lineno)
More Related Contents:
- check what files are open in Python
- how to can i go over a file twice?
- open() gives FileNotFoundError/IOError: Errno 2 No such file or directory
- How to step through Python code to help debug issues?
- How do I get the path and name of the file that is currently executing?
- How to debug in Django, the good way? [closed]
- Sorting text file by using Python
- Skip first couple of lines while reading lines in Python file
- Monitoring contents of files/directories? [duplicate]
- What is the most efficient way to get first and last line of a text file?
- Do I understand os.walk right?
- How do I remove/delete a folder that is not empty?
- Writing a list to a file with Python, with newlines
- How to do virtual file processing?
- Getting file size in Python? [duplicate]
- Starting python debugger automatically on error
- Search for a file using a wildcard
- Python append multiple files in given order to one big file
- Save a large file using the Python requests library [duplicate]
- How to add a key-value to JSON data retrieved from a file?
- How does python close files that have been gc’ed?
- Why do I get “Pickle – EOFError: Ran out of input” reading an empty file?
- How do I wrap a string in a file in Python?
- “TypeError: a bytes-like object is required, not ‘str'” when handling file content in Python 3
- For loop not working twice on the same file descriptor [duplicate]
- f.read coming up empty
- List comprehension scope error from Python debugger
- Read random lines from huge CSV file
- What is the difference between .py and .pyc files? [duplicate]
- how to count the total number of lines in a text file using python