Skip to content

Commit b23894d

Browse files
authored
Fixes #797. (#798)
1 parent 34f4cef commit b23894d

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

scalene/find_browser.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ def find_browser(browserClass=None) -> Optional[str]:
1212
try:
1313
# Get the default browser object
1414
browser = webbrowser.get(browserClass)
15-
return browser.name if browser.name not in text_browsers else None
15+
browser_name = browser.name if browser.name else browser.__class__.__name__
16+
return browser_name if browser_name not in text_browsers else None
1617
except AttributeError:
1718
# https://github.com/plasma-umass/scalene/issues/790
1819
# https://github.com/python/cpython/issues/105545

scalene/launchbrowser.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from jinja2 import Environment, FileSystemLoader
1616
from typing import Any, NewType
1717

18-
import scalene.scalene_config
18+
import scalene_config
1919

2020
def read_file_content(directory: str, subdirectory: str, filename: str) -> str:
2121
file_path = os.path.join(directory, subdirectory, filename)
@@ -35,16 +35,12 @@ def launch_browser_insecure(url: str) -> None:
3535
# Create a command with the required flags
3636
chrome_cmd = f'{chrome_path} %s --disable-web-security --user-data-dir="{temp_dir}"'
3737

38-
# print(chrome_cmd)
39-
4038
# Register the new browser type
4139
webbrowser.register('chrome_with_flags', None,
4240
webbrowser.Chrome(chrome_cmd), preferred=True)
4341

4442
# Open a URL using the new browser type
45-
# url = 'https://cnn.com' # Replace with your desired URL
4643
webbrowser.get(chrome_cmd).open(url)
47-
# webbrowser.get('chrome_with_flags').open(url)
4844

4945

5046
HOST = 'localhost'
@@ -133,8 +129,8 @@ def generate_html(profile_fname: Filename, output_fname: Filename) -> None:
133129
prism_js=file_contents['prism_js_text'],
134130
tablesort_js=file_contents['tablesort_js_text'],
135131
tablesort_number_js=file_contents['tablesort_number_js_text'],
136-
scalene_version=scalene.scalene_config.scalene_version,
137-
scalene_date=scalene.scalene_config.scalene_date,
132+
scalene_version=scalene_config.scalene_version,
133+
scalene_date=scalene_config.scalene_date,
138134
)
139135

140136
# Write the rendered content to the specified output file.
@@ -170,7 +166,6 @@ def start(filename: str, port: int) -> None:
170166

171167
if __name__ == '__main__':
172168
import sys
173-
print(sys.argv)
174169
if len(sys.argv) > 2:
175170
filename = sys.argv[1]
176171
port = int(sys.argv[2])

scalene/scalene_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Current version of Scalene; reported by --version."""
22

3-
scalene_version = "1.5.37"
4-
scalene_date = "2024.03.10"
3+
scalene_version = "1.5.38"
4+
scalene_date = "2024.03.24"
55

66
# Port to use for Scalene UI
77
SCALENE_PORT = 11235

0 commit comments

Comments
 (0)