On Mon, 2 May 2022 20:33:02 +1200, dn <pythonl...@danceswithmice.info> declaimed the following:
>Perhaps an MS-Win user can help the OP, please? Not really -- at least from my viewpoint there is not enough information to perform any diagnoses... Other than to recommend that, if the OP initially posted to the list/newsgroup, they should ensure any replies also go to the same (I don't respond to what should be group replies that appear in my personal mail -- which is what the OP did for me also). {Hmmm, appears the quoted content is below your signature block, and my client doesn't quote standard signatures and below... time for some nasty cut&paste} >From: Brent Hunter <br...@brenthunter.tv> >Date: Mon, 2 May 2022 00:30:22 +0000 > >I was recently running a Windows 10 machine and I believe it was running >Python 3.8. All I did was create a batch file titled Start-AIG.bat which >simply contained the following: "pythonw AIG.py". It started a python program >titled "AIG.py" and the Python dialog box was displayed on my screen, running >all day and night. I set up Windows to run this batch file upon startup and >it worked fine. I remember having to do a bunch of research before I learned >that I needed to put "pythonw AIG.py" in the batch file as opposed to "python >AIG.py". > What in particular is a "Python dialog box"? Python doesn't, of its own, have dialog boxes. Add-on libraries: Tkinter, wxPython, the win32 extensions, et al. allow one to code scripts that produce dialogs, but the dialogs are specific to the library. "pythonw" is the name of the interpreter meant for use with programs that do not use console I/O -- IOW, pure GUI (one of the aforesaid libraries). Normally such programs are given the extension .pyw rather than .py -- and (at least on my system), .pyw files are automatically associated with pythonw. Just providing the script name with extension is sufficient. Though there is the matter that giving said name in a command line prompt means one still has a console active. .pyw files are meant to be started from the file explorer by double-clicking on them, and one doesn't want to have a console window popping up if it is never used (which is what happens if one double-clicks on a plain .py file). HOW did you "set up Windows to run this batch file upon startup"? Windows used to support (and still does if https://www.thewindowsclub.com/startup-folder-in-windows-8 is correct [ignore the -8, the site is updated for 10/11]). This is per user start up (unless one uses the "all users" path). The Windows task scheduler also allows one to create tasks that run on a schedule -- said schedule including options for specific user logging in, any user logging in, computer start-up, etc. The scheduler is probably the recommended way to set up things. >However, my old windows 10 desktop crashed and I have a new Windows 11 >machine. I installed the latest stable version of Python, which is 3.10. >Now, when I try to execute the same batch file, it doesn't launch the app. It >could be because I'm using Windows 11 or could be because I now have a newer >version of Python. > >With this additional information, do you have any ideas what I should do to >get the Python script running in the same way I had it running before? As I stated above -- insufficient information. Is Python installed for all users or just one? Is "pythonw" on the system PATH? Is the script meant to only run for one user or any user? How was the script configured to start? Is the script in a valid directory (I believe in a previous post it was mentioned that you had the script in the directory used for per user START-MENU entries; that is not meant for user files!). My first approach would be to open a console and run the script manually (not the BAT file) -- does any error message appear in the console? Running using pythonw suppresses console, error messages would be lost -- GUI applications are expected to trap any runtime errors and either write to a log file or pop-up a dialog for them. Then, after getting it to run in a console, I'd try it by double-clicking on the file (rename it to .pyw so you get the no-console interpreter). If Windows says it doesn't know how to run .pyw, it implies that there is no file association set up in Windows telling it how to run that extension. NO BAT file should be required for a one-liner that does no parameter substitution. If using the "startup" directory method, create a shortcut for the script (right-click, drag, create shortcut here). Right-click/Properties. If you don't have associations set to run that extension type, prefix the Target box with the path to the python(w) executable. Move the shortcut to the proper startup directory -- Note that if you put it in the all-users startup, you have to make sure that the script and shortcut themselves are not in protected (single user) locations. Using the task scheduler, you'd have similar constraints on directories, but shouldn't need to create a shortcut file. Instead, you'd specify the path to the interpreter and the path to the script as the task ACTION, with the applicable start option as the TRIGGER. -- Wulfraed Dennis Lee Bieber AF6VN wlfr...@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/ -- https://mail.python.org/mailman/listinfo/python-list