Python Forum
Can't get .py to run on Win10 command line
Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can't get .py to run on Win10 command line
#1
Hi,

I'm trying to run my python script from a Windows 10 command prompt (batch file).

It works if I'm in the correct directory of where my python script resides (outside of python install dir); but not if I'm in a different directory.

My python 3.6.1 install is here:  C:\Users\John\AppData\Local\Programs\Python\Python36\python.exe
My python script is here:  C:\Python_TestScript\runtime\jm_run.py

If I change directory to C:\Python_TestScript\ and try to run I get:
Quote:C:\Python_TestScript>C:\Users\John\AppData\Local\Programs\Python\Python36\python.exe C:\Python_TestScript\runtime\jm_run.py

C:\Python_TestScript>

However, if I change to the directory in which the script resides C:\Python_TestScript\runtime\  it works as expected:
Quote:C:\Python_TestScript\runtime>C:\Users\John\AppData\Local\Programs\Python\Python36\python.exe C:\Python_TestScript\runtime\jm_run.py
Creating summariser <summary>
Created the tree successfully using C:\!!PythonTest\KickOffTest\test.jmx
Starting the test @ Tue Nov 07 14:34:14 GMT 2017 (1510065254649)
Waiting for possible Shutdown/StopTestNow/Heapdump message on port 4445
summary =     10 in 00:00:02 =    4.3/s Avg:   376 Min:   104 Max:  1591 Err:     0 (0.00%)
Tidying up ...    @ Tue Nov 07 14:34:17 GMT 2017 (1510065257651)
... end of run
***** DONE *****

C:\Python_TestScript\runtime>


Any ideas?  This seems a bit odd to me.

Cheers,
J
Reply


Messages In This Thread
Can't get .py to run on Win10 command line - by jonesin1974 - Nov-07-2017, 02:36 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Command line argument issue space issue mg24 5 1,402 Oct-26-2022, 11:05 PM
Last Post: Yoriz
  accept command line argument mg24 5 1,397 Sep-27-2022, 05:58 PM
Last Post: snippsat
  Accessing varying command line arguements Rakshan 3 2,107 Jul-28-2021, 03:18 PM
Last Post: snippsat
  Where does pip auto install on Win10 with py 3.9.4? Fran_3 4 3,586 May-05-2021, 03:47 PM
Last Post: snippsat
  How to input & output parameters from command line argument shantanu97 1 2,622 Apr-13-2021, 02:12 PM
Last Post: Larz60+
  Passing List of Objects in Command Line Python usman 7 3,285 Sep-27-2020, 03:45 PM
Last Post: ndc85430
  Compiling on win10 ebolisa 1 1,790 Sep-04-2020, 04:39 PM
Last Post: ebolisa
  Taking Multiple Command Line Argument Input bwdu 6 4,118 Mar-29-2020, 05:52 PM
Last Post: buran
  python 3 from command line Dixon 1 2,070 Mar-01-2020, 08:35 PM
Last Post: snippsat
  Running linux command line apps... dbrdh 0 1,691 Jan-30-2020, 01:14 PM
Last Post: dbrdh

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020