Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions emrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.

# This file needs to run on older version of python too (even python 2!) so
# suppress these upgrade warnings:
# ruff: noqa: UP015, UP024, UP021, UP025

"""emrun: Tool for running an .html page as if it was a standard executable file.

Usage: emrun <options> filename.html <args to program>
Expand Down Expand Up @@ -612,7 +608,7 @@ def send_head(self):

try:
f = open(path, 'rb')
except IOError:
except OSError:
self.send_error(404, "File not found: " + path)
return None

Expand Down Expand Up @@ -848,19 +844,19 @@ def find_gpu_model(model):
hVideoCardReg = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, CleanVideoCardString)
try:
VideoCardDescription = winreg.QueryValueEx(hVideoCardReg, 'Device Description')[0]
except WindowsError:
except OSError:
VideoCardDescription = winreg.QueryValueEx(hVideoCardReg, 'DriverDesc')[0]

try:
driverVersion = winreg.QueryValueEx(hVideoCardReg, 'DriverVersion')[0]
VideoCardDescription += ', driver version ' + driverVersion
except WindowsError:
except OSError:
pass

try:
driverDate = winreg.QueryValueEx(hVideoCardReg, 'DriverDate')[0]
VideoCardDescription += f' ({driverDate})'
except WindowsError:
except OSError:
pass

VideoCardMemorySize = winreg.QueryValueEx(hVideoCardReg, 'HardwareInformation.MemorySize')[0]
Expand All @@ -870,7 +866,7 @@ def find_gpu_model(model):
vram = int(VideoCardMemorySize)
if not find_gpu_model(VideoCardDescription):
gpus += [{'model': VideoCardDescription, 'ram': vram}]
except WindowsError:
except OSError:
pass
return gpus

Expand Down Expand Up @@ -1030,7 +1026,7 @@ def win_get_file_properties(fname):

strInfo = {}
for propName in propNames:
strInfoPath = u'\\StringFileInfo\\%04X%04X\\%s' % (lang, codepage, propName)
strInfoPath = '\\StringFileInfo\\%04X%04X\\%s' % (lang, codepage, propName)
# print str_info
strInfo[propName] = win32api.GetFileVersionInfo(fname, strInfoPath)

Expand All @@ -1046,7 +1042,7 @@ def get_computer_model():
with open(os.path.join(os.getenv("HOME"), '.emrun.hwmodel.cached'), encoding='utf-8') as f:
model = f.read()
return model
except IOError:
except OSError:
pass

try:
Expand Down Expand Up @@ -1167,7 +1163,7 @@ def win_get_default_browser():
parts = shlex.split(cmd)
if len(parts):
return [parts[0]]
except WindowsError:
except OSError:
Comment thread
sbc100 marked this conversation as resolved.
logv("Unable to find default browser key in Windows registry. Trying fallback.")

# Fall back to 'start "" %1', which we have to treat as if user passed --serve-forever, since
Expand Down
Loading