-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsysModule.py
More file actions
33 lines (19 loc) · 721 Bytes
/
Copy pathsysModule.py
File metadata and controls
33 lines (19 loc) · 721 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""
You can communicate back with the shel from the script, by opening cmd and typing;
import subprocess
subprocess.call('python sysModule.py "arguments"', shell = True)
# To store the output you can type;
varOutput = subprocess.check_output('python sysModule.py "arguments"', shell = True)
print(varOutput)
"""
import sys
def main(var1):
print('From main',var1)
sys.stderr.write("This is an error text!\n")
sys.stderr.flush()
sys.stdout.write("This is the system.out.print of python!\n")
print(sys.argv) # Use this to communicate b/w python and other language. This is used to send commandline arguments.
if len(sys.argv) > 1:
print(sys.argv[1])
print(float(sys.argv[1]) + 5)
main(sys.argv[1])