I having the problem. When I restart the app from source, the restart works 
fine. But, when I compile it, the restart code doesn't work properly. This 
error appears. usage: MyApp [-h] [-c CONFIG] [-C CACHE] [-l LOG] 
[--devices] [--default-config]
MyApp: error: unrecognized arguments: /home/myapp/MyApp
But, I'm not passing any args. How can I fix it?
If I start the app, its starting fine. It's only on restart that there's a 
problem.
I'm using debian11 and python 3.9.2. And, i'm using pyinstaller 5.7.0.
Here is my restart code.
<code>
class RestartCommand(Command):
    @property
    def help(self) -> str:
        return "Restarts the app"

    def __call__(self, arg: str, user: User) -> Optional[str]:
        self._bot.close()
        try:
            if 'frozen' in sys.builtin_module_names:
                executable = sys.executable
                if sys.platform == "win32":
                    subprocess.run([executable] + sys.argv[1:])
                else:
                    subprocess.run([executable, "-m", "__main__"] + 
sys.argv[1:])
            else:
                args = sys.argv
                if sys.platform == "win32":
                    subprocess.run([sys.executable] + args)
                else:
                    args.insert(0, sys.executable)
                    os.execv(sys.executable, args)
        except Exception as e:
            print("Error while restarting: ", e)
</code>

-- 
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pyinstaller+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyinstaller/eda8c4eb-ddc5-4fb7-b2d8-2a3a4e8a5d83n%40googlegroups.com.

Reply via email to