Tibo1211
Tibo1211

Reputation: 37

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.

Upvotes: 0

Views: 640

Answers (2)

Scene
Scene

Reputation: 509

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.

Upvotes: 1

Aditya
Aditya

Reputation: 1329

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

Upvotes: 0

Related Questions