Python Forum
running python script from shell invoked with os.system("x-terminal-emulator -e /bin/
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
running python script from shell invoked with os.system("x-terminal-emulator -e /bin/
#1
I have the following code in a file "hello.py":


#!/usr/bin/python3

import os

import time
os.system("x-terminal-emulator -e /bin/bash")

var = input("Please enter your name: ")
print("You entered " + str(var))
time.sleep(5)
os._exit(1)

I would like to run the script in the spawned terminal. I have searched google and the forums and have no answer. Any help would be appreciated.
Reply
#2
Are you trying to create a virus?
doing what you suggest will quickly overload the OS.
Although it will be slowed down by the input statement.
Reply
#3
no virus. Trying to open a terminal window, run the little script to capture the name, print that output, and then close the terminal. This works when I run it from a terminal:
it captures the input, prints it, and exits 5 seconds later no problem. I just can't do it from within this one file and I cannot figure out why. Thanks for responding. It's just a learning exercise and I'm having no luck.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  No Internet connection when running a Python script basil_555 8 442 Mar-11-2024, 11:02 AM
Last Post: snippsat
Question Running Python script through Task Scheduler? Winfried 8 335 Mar-10-2024, 07:24 PM
Last Post: Winfried
  Help Running Python Script in Mac OS emojistickers 0 306 Nov-20-2023, 01:58 PM
Last Post: emojistickers
  Trying to make a board with turtle, nothing happens when running script Quascia 3 607 Nov-01-2023, 03:11 PM
Last Post: deanhystad
  Help creating shell scrip for python file marciokoko 10 1,256 Sep-16-2023, 09:46 PM
Last Post: snippsat
  invoking python in Terminal Euler 2 591 Aug-25-2023, 06:17 AM
Last Post: perfringo
  Is there a *.bat DOS batch script to *.py Python Script converter? pstein 3 3,007 Jun-29-2023, 11:57 AM
Last Post: gologica
  Python script running under windows over nssm.exe JaroslavZ 0 671 May-12-2023, 09:22 AM
Last Post: JaroslavZ
  Launch Python IDLE Shell from terminal Pavel_47 5 1,143 Feb-17-2023, 02:53 PM
Last Post: Pavel_47
  Running script with subprocess in another directory paul18fr 1 3,478 Jan-20-2023, 02:33 PM
Last Post: paul18fr

Forum Jump:

User Panel Messages

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