Skip to content

Commit d821a28

Browse files
committed
fix syntax
1 parent dd58ad9 commit d821a28

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

jupyter_xprahtml5/__init__.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,19 @@
66

77
HERE = os.path.dirname(os.path.abspath(__file__))
88

9+
910
def _xprahtml5_mappath(path):
1011
from getpass import getuser
11-
12+
1213
uri_parms = '?' + '&'.join([
1314
'username=' + getuser(),
14-
# 'password=' + _xprahtml5_passwd,
15-
# 'encryption=AES',
16-
# 'key=' + _xprahtml5_aeskey,
17-
# 'sharing=true',
15+
# 'password=' + _xprahtml5_passwd,
16+
# 'encryption=AES',
17+
# 'key=' + _xprahtml5_aeskey,
18+
# 'sharing=true',
1819
])
1920

20-
if path in ('/', '/index.html', ):
21+
if path in ('/', '/index.html', ):
2122
path = '/index.html' + uri_parms
2223
logger.info('Xpra URI: ' + path)
2324

@@ -32,7 +33,6 @@ def setup_xprahtml5():
3233
from tempfile import gettempdir, mkstemp
3334
from random import choice
3435
from string import ascii_letters, digits
35-
from getpass import getuser
3636

3737
global _xprahtml5_passwd, _xprahtml5_aeskey
3838

@@ -55,7 +55,7 @@ def _get_random_alphanumeric_string(length):
5555
with open(fd_passwd, 'w') as f:
5656
f.write(_xprahtml5_passwd)
5757

58-
except:
58+
except Exception:
5959
logger.error("Passwd generation in temp file FAILED")
6060
raise FileNotFoundError("Passwd generation in temp file FAILED")
6161

@@ -67,31 +67,32 @@ def _get_random_alphanumeric_string(length):
6767

6868
with open(fd_aeskey, 'w') as f:
6969
f.write(_xprahtml5_aeskey)
70-
except:
70+
71+
except Exception:
7172
logger.error("Encryption key generation in temp file FAILED")
7273
raise FileNotFoundError("Encryption key generation in temp file FAILED")
7374

7475
# create command
75-
cmd = [ os.path.join(HERE, 'share/launch_xpra.sh'),
76+
cmd = [os.path.join(HERE, 'share/launch_xpra.sh'),
7677
'start',
7778
'--html=on',
7879
'--bind-tcp=0.0.0.0:{port}',
79-
# '--socket-dir="' + socket_path + '/"', fixme: socket_dir not recognized
80+
# '--socket-dir="' + socket_path + '/"', fixme: socket_dir not recognized
8081
'--server-idle-timeout=86400', # stop server after 24h with no client connection
8182
'--start=xterm',
82-
# '--start-child=xterm', '--exit-with-children',
83-
# '--tcp-auth=file:filename=' + fpath_passwd,
84-
# '--tcp-encryption=AES',
85-
# '--tcp-encryption-keyfile=' + fpath_aeskey,
83+
# '--start-child=xterm', '--exit-with-children',
84+
# '--tcp-auth=file:filename=' + fpath_passwd,
85+
# '--tcp-encryption=AES',
86+
# '--tcp-encryption-keyfile=' + fpath_aeskey,
8687
'--clipboard-direction=both',
8788
'--no-bell',
8889
'--no-speaker',
8990
'--no-printing',
9091
'--no-microphone',
9192
'--no-notifications',
9293
'--dpi=96',
93-
# '--sharing'
94-
]
94+
# '--sharing',
95+
]
9596
logger.info('Xpra command: ' + ' '.join(cmd))
9697

9798
return {
@@ -100,7 +101,7 @@ def _get_random_alphanumeric_string(length):
100101
},
101102
'command': cmd,
102103
'mappath': _xprahtml5_mappath,
103-
'absolute_url': False,
104+
'absolute_url': False,
104105
'timeout': 30,
105106
'new_browser_tab': True,
106107
'launcher_entry': {

0 commit comments

Comments
 (0)