Re: Difference in Setup Between Windows 10 Running Python 3.9 and Windows 11 Running Python 3.10

2022-05-03 Thread Eryk Sun
On 5/1/22, Brent Hunter  wrote:
>
> I was recently running a Windows 10 machine Python 3.9.  I simply created 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".

When running a command at startup, it's best to use the full path of
the application and the full path of any files passed on the command
line. For example, run something like the following:

"path\to\pythonw.exe" "path\to\AIG.py"

This removes any dependency on the search PATH or the current working
directory. Also, the script shouldn't depend on the initial working
directory. Any files that it needs should be in a well-known location,
such as the script directory,
os.path.dirname(os.path.abspath(__file__)).

Also, there's no need to use a batch script just to run a single
command. When you use a batch script, a visible console gets created
for CMD. It doesn't close until CMD exits, which in this case won't be
until pythonw.exe exits, unless you use `START` to run the command
without waiting. It's simpler to just run the command directly using a
shortcut (i.e. LNK file) or the task scheduler.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Difference in Setup Between Windows 10 Running Python 3.9 and Windows 11 Running Python 3.10

2022-05-01 Thread MRAB

On 2022-05-02 02:56, Brent Hunter wrote:

Hello,

I was recently running a Windows 10 machine Python 3.9.  I simply created 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".

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.

Does anyone have any ideas what I should do to get the Python script running on 
my new machine?

The problem is probably that the Python folder isn't in Windows' search 
path, but the recommended thing to do nowadays on Windows is to use the 
Python Launcher "py.exe" (or "pyw.exe" for no console window) instead:


pyw AIG.py
--
https://mail.python.org/mailman/listinfo/python-list


Difference in Setup Between Windows 10 Running Python 3.9 and Windows 11 Running Python 3.10

2022-05-01 Thread Brent Hunter
Hello,



I was recently running a Windows 10 machine Python 3.9.  I simply created 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".



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.



Does anyone have any ideas what I should do to get the Python script running on 
my new machine?



Thank you!



Brent

-- 
https://mail.python.org/mailman/listinfo/python-list