Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
os.popen problem
#2
Use subprocess and advise run() function for all use cases it can handle.
import subprocess

result = subprocess.run(['ipconfig'], encoding='utf-8', capture_output=True)
print(result.stdout)
No force it to utf-8(Python's default encoding),Windows can sometime use charmap encoding when call external stuff.
Reply


Messages In This Thread
os.popen problem - by thefrog - Mar-31-2024, 03:15 PM
RE: os.popen problem - by snippsat - Mar-31-2024, 04:24 PM

Forum Jump:

User Panel Messages

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