Python "freeze" does not include namespace

This is the script called sharkfest.py:

import os, sys  if __name__ == '__main__':     print(sys.modules[__name__]) 

When I run the script, it displays the module name as sharkfest.py

Python38-32\python.exe sharkfest.py  <module '__main__' from 'sharkfest.py'>  

but when I freeze it and run it as an executable the module name is built-in

This is the setup.py file:

from cx_Freeze import setup, Executable options = {"packages":["errno","psycopg2","requests","simplecrypt"]} setup(name = "Shark" ,     version = "0.1" ,     description = "" ,     options= {"build_exe": options},     executables = [Executable("sharkfest.py")]) 

Here is the command used to freeze:

c:\Python38-32\python.exe setup.py build 

and here is the output when running the executable sharkfest.exe:

module '__main__' (built-in) 

My question is, how can I have the module to be sharkfest.py and not built-in. is there any parameter or option that needs to be added to the setup.py file?

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.