0

I have to check versions of different software and their proper patches and I have written a python script that works (developed in my office laptop).

Now I have to run the scripts in my labs and the lab PCs do not have python and I am not allowed to install python on them.

Is there a way to run my python script in the labs?

Options I have seen

  1. Convert my python to an EXE and run it.

    • If I choose this option, I do not prefer the use of the scheduler to run the EXE in a fixed time as the labs may be used for testing.

    • How do I create API for my code so I can call the API and run it as needed?

    • or is there a better way than I have missed?

Muhammad Usman Bashir
  • 1,441
  • 2
  • 14
  • 43
RRK
  • 9
  • 1
  • 3
  • https://stackoverflow.com/questions/5458048/how-to-make-a-python-script-standalone-executable-to-run-without-any-dependency – moo Jan 31 '20 at 10:46
  • Does this answer your question? [How to make a Python script standalone executable to run without ANY dependency?](https://stackoverflow.com/questions/5458048/how-to-make-a-python-script-standalone-executable-to-run-without-any-dependency) – moo Jan 31 '20 at 10:47
  • Yes , this is similar to my requirement. Thanks – RRK Feb 04 '20 at 05:27

1 Answers1

1

You could use this alternative way if you dont want to compile to EXE:

For Running Script

  1. Download Portable Python in Folder here
  2. (Optional for additional packeges used) Place venv(Python Virtual Enviroment) in same folder
  3. (Optional) Use venv with python.exe -m venv env
  4. Open cmd in folder with python.exe
  5. Run your script with python.exe script.py

For API:

You can use arguments for API ,it depends how much time and effort you want to put in.

  1. Use sys.args and run script with required arguments
  2. Use TCP Server on allowed ports and listen for commands* (Can be time consuming if you didnt worked with TCP)*