Python Forum
multi-line CMD in one-line python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
multi-line CMD in one-line python
#4
(Jan-01-2022, 09:10 AM)kucingkembar Wrote: he purpose is making GUI program using that install the missing "packages" in a new window,
lets said the user needs "packages" called NumPy that are not installed,
then the program will open a new cmd window showing the package being install,
instead "not responding" Tkinter window GUI
(usually, users will kill this process or think this program is not professional)
In general should make packages included when install with pip.
So then it's done in setup.py with install_requires .
Then all is done with pip install my_pacakge.

There can be serval problems that can occurs if try to this for users after install.
Also should not use os.system(unsafe) as subprocces has taken over that task.
Should capture output so know what going on,did it work(error message) or eg is is it already installed.
import subprocess

output = subprocess.run('pip install numpy', capture_output=True, encoding='utf-8')
print(output.stdout)
Output:
Requirement already satisfied: numpy in c:\python39\lib\site-packages (1.20.2)
Reply


Messages In This Thread
multi-line CMD in one-line python - by kucingkembar - Jan-01-2022, 05:06 AM
RE: multi-line CMD in one-line python - by snippsat - Jan-01-2022, 12:15 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Information Is it possible to multi line a Basic Function Construct line statement? If so how? BrandonKastning 7 382 May-23-2024, 03:02 PM
Last Post: deanhystad
  Line graph with two superimposed lines sawtooth500 4 471 Apr-02-2024, 08:56 PM
Last Post: sawtooth500
  How to add multi-line comment section? Winfried 1 295 Mar-24-2024, 04:34 PM
Last Post: deanhystad
  break print_format lengthy line akbarza 4 490 Mar-13-2024, 08:35 AM
Last Post: akbarza
  Reading and storing a line of output from pexpect child eagerissac 1 4,433 Feb-20-2024, 05:51 AM
Last Post: ayoshittu
  coma separator is printed on a new line for some reason tester_V 4 623 Feb-02-2024, 06:06 PM
Last Post: tester_V
  problem with spliting line in print akbarza 3 501 Jan-23-2024, 04:11 PM
Last Post: deanhystad
  Unable to understand the meaning of the line of code. jahuja73 0 401 Jan-23-2024, 05:09 AM
Last Post: jahuja73
  Receive Input on Same Line? johnywhy 8 941 Jan-16-2024, 03:45 AM
Last Post: johnywhy
  Reading in of line not working? garynewport 2 951 Sep-19-2023, 02:22 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

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