-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathutils.py
More file actions
40 lines (34 loc) · 1.15 KB
/
utils.py
File metadata and controls
40 lines (34 loc) · 1.15 KB
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
33
34
35
36
37
38
39
40
#from __main__ import *
def hello():
print("Hello! There.")
print("__name__",__name__)
import sys
print(sys.argv)
# import sys
# print("__name__",__name__)
# print("===",sys.argv)
def open_in_ipython(script_path, args_string):
import os
#import subprocess
os_name = os.name
use_system = True
#seems we are in jython context.
if os_name == "java":
os_name = os_name.getshadow()
print(os_name)
start_string = ""
if os_name == "nt":
start_string = "start /wait cmd /c ipython3 %s -i -- %s" %(script_path, args_string)
#start_string = "start cmd /c ipython3 %s -i -- %s" %(script_path, args_string)
else:
start_string = "gnome-terminal -- ipython3 %s -i -- %s" %(script_path, args_string)
if use_system:
ret = os.system(start_string)
print(ret)
else:
# p = subprocess.Popen("start /wait cmd /k ipython3 ./angr_util.py -i -- hahahaha",shell=True,stdin=subprocess.PIPE, stdout=subprocess.PIPE)
# w = input()
# p.wait()
ret = os.popen(start_string)
print(ret.read())
#print("it's over.")