简体   繁体   中英

Get the original script name of a python executable

I have a program coded in python named: "main.exe" And I would like to know the name of the script it had before being convert into an executable.

In case the executable has been renamed, it doesn't have the same name as the original script.

I hope you understood me. An example to illustrate:

get_original_name(main.exe)
-> script.py

Thanks a lot.

It is Not Possible, Since the Filename and the Compiled Program Have No Link,

But tools like Resource Hacker Can get you alot of information about that particular Program, and it can be used in other things Too

If possible, you can access the name of the py file via:

import os
print(os.path.basename(__file__))

If you were to compile this code and give the exe a new name with pyinstaller, the original script name will be printed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM