DearPyGui
DearPyGui copied to clipboard
How to report the logfile to Windows when using DearPyGui?
I encountered a problem when trying to package a Python script written with DearPyGui. The script includes an executable file (muscle5.1.win64.exe) that I use within the Python code. When I run the script in PyCharm, it works fine. However, when I package it into an executable file, it crashes (flashes back)
Thank you!
My Improvement
Is there a way to report the logfile, so I can find where the issue is occurring?
Here is my script:
def muscle_main(): muscle_input = dpg.get_value("DPrime_input_fasta") muscle_output = dpg.get_value("DPrime_msa_output") os.system("{}/muscle5.1.win64.exe -align {} -output {}".format(os.path.abspath(os.path.join(os.path.dirname(file),"Scripts")), muscle_input, muscle_output))
Please enclose your script with a code block:
Pasting it in plain text (without the code block) removes indentation and renders Python code unreadable.
Also, pathlib
makes it much easier (and more readable) to manage paths. F-strings do the same to string formatting.
from pathlib import Path
exe_path = Path(__file__).parent / "Scripts/muscle5.1.win64.exe"
os.system(f"{exe_path.resolve()} -align {muscle_input} -output {muscle_output}")
Can you post a screenshot of the error message that you get when it crashes? Or a copy of its text.
If you comment out the os.system
line, does your packaged version still crash? If not, then it's clearly related to muscle5.1.win64.exe
and has nothing to do with DearPyGui. In that case, I'd recommend asking on StackOverflow because it's not a DearPyGui issue. Let's try to comment out that line and see what happens.
Oh! Thanks for your reply. Sorry about the delayed response. Here is an overview of my DearpyGUI application. When I click the run button, nothing happens and there is no functionality executed. It seems that the main window cant find the exe file in next fig:
Here is the exe file that I used for my DearpyGUI application:
Here is the main window that I designed in DearpyGUI:
Here is the PyInstaller command to build the main window into a single file:
The problem is that when I run the dearpyGUI in PyCharm, it works well. However, when I build the main function into an executable file, it doesn't run successfully.
Additionally, sometimes Python scripts can't run successfully and throw a bug report, but the main window won't show any response. If there is a log file in this Windows that I could follow up on, maybe I can find what caused the problem. That's why I asked this question.
Well, my problem has been resolved, but I'm still wondering if the dearpygui window can provide a log or bug report for developers. Maybe there is a similar function that I don't know about. If you have any ideas, I would be greatly thankful for your kindness. In the end, I really like dearpygui. Thanks for your effort.
Well, os.system
is not a DearPyGui function and looks like it's what was failing in your case. So DearPyGui can't really provide any diagnostics (log or whatever else) on a function that is not even its own.
You could try to run your EXE from within cmd.exe
and see if there's any output there. Or, if you suspect that os.system
fails (or any other function, for that matter), you can always wrap it with a try-except block and catch the exception, then do something like dpg.add_text(str(e))
. Read up on Python exceptions, that's an integral part of Python so you'd better learn it.
@Pcothren, I appreciate your assistance. Can DearPyGUI provide a real-time interactive interface?
Pcothren is probably too busy to answer, but anyway... it would help if you explained in a bit more detail what you mean by saying "provide a real-time interactive interface".