Skip to content

Commit 7f105a5

Browse files
committed
fix: 修复python23兼容问题
1 parent 9477928 commit 7f105a5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Windows/JumpServer.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
import platform
88
import subprocess
99

10+
# 兼容python 2, 3
11+
try:
12+
reload(sys)
13+
sys.setdefaultencoding('utf-8')
14+
except Exception:
15+
pass
16+
1017
'''
1118
{
1219
"filename": "{}-{}-jumpserver".format(username, name),
@@ -23,7 +30,7 @@ def remove_current_rdp_file():
2330
re_rdp_file = re.compile(r'.*\.rdp$')
2431
for filename in os.listdir(BASE_DIR):
2532
if re_rdp_file.search(filename):
26-
os.remove(os.path.join(filename))
33+
os.remove(os.path.join(BASE_DIR, filename))
2734

2835

2936
class Rouse(object):

0 commit comments

Comments
 (0)