Giter Site home page Giter Site logo

Comments (11)

jiffyclub avatar jiffyclub commented on September 26, 2024

Can you open a Python interpreter, enter the following, and let me know what happens?

>>> import webbrowser
>>> webbrowser.open('http://www.python.org')

from snakeviz.

jiffyclub avatar jiffyclub commented on September 26, 2024

Can you also go to the "General" pane of the System Preferences and check that you have a default web browser set? Here's what mine looks like, but I'm on Yosemite so yours will look somewhat different.

screenshot 2015-02-15 19 20 28

from snakeviz.

kakyoism avatar kakyoism commented on September 26, 2024

import webbrowser
webbrowser.open('http://www.python.org')

This gives me "True".

My default browser is Safari.app

from snakeviz.

kakyoism avatar kakyoism commented on September 26, 2024

BTW, the command line does end up opening the python homepage in Safari.

from snakeviz.

jiffyclub avatar jiffyclub commented on September 26, 2024

Thanks. Here's another experiment for the console, if you don't mind. What's the output of this?

>>> import webbrowser
>>> webbrowser.get()

And then try:

>>> webbrowser.get().open('http://www.python.org')

Thanks!

from snakeviz.

kakyoism avatar kakyoism commented on September 26, 2024

import webbrowser
webbrowser.get()
webbrowser.GenericBrowser object at 0x10f55e3d0
webbrowser.get().open('http://www.python.org')
False

from snakeviz.

jiffyclub avatar jiffyclub commented on September 26, 2024

As you might have guessed, that second way is how snakeviz is trying to open your browser, and that's why you're not ending up with anything happening.

It's really weird that webbrowser.open() works and webbrowser.get().open() doesn't. I can't reproduce that even if I install Python 2.7.5 and set my default browser to Safari. :(

One thing to try is explicitly specifying a browser to snakeviz using the -b/--browser flag. E.g.: snakeviz -b safari myprofile.

As a last resort, you can manually copy the URL printed to the terminal by snakeviz (e.g. 127.0.0.1:8080) and paste that into a browser.

Sorry I can't be more help, I'm totally stumped.

from snakeviz.

kakyoism avatar kakyoism commented on September 26, 2024

I tried to c&p the address (127.0.0.1:8080) into Safari while the snakeviz server was running, and here is what I got:

Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/tornado/web.py", line 1323, in _execute
result = self.prepare()
File "/Library/Python/2.7/site-packages/tornado/web.py", line 2014, in prepare
raise HTTPError(self._status_code)
HTTPError: HTTP 404: Not Found

Thank you for your patience.

from snakeviz.

jiffyclub avatar jiffyclub commented on September 26, 2024

I apologize, I gave you some bad advice there. Snakeviz does not print out a complete URL that you can paste into a browser. I'll make an issue to fix that.

Have you tried the -b option to manually specify the browser?

from snakeviz.

kakyoism avatar kakyoism commented on September 26, 2024

"-b safari" solved the problem. Thanks a lot!
I had thought I ought to use the full path to the executable which would have been /Applications/Safari.app/Contents/MacOS/Safari . This never worked.

You might consider revising the help text about the -b option, currently saying:
"""
path to the web browser executable to use to open the visualization;
"""

Again, thanks for the prompt help!

from snakeviz.

jiffyclub avatar jiffyclub commented on September 26, 2024

Good idea, thanks. I only learned about that trying to figure out how to help you. 😸 You can see a list of all the browsers the webbrowser module knows about at https://docs.python.org/3.4/library/webbrowser.html.

from snakeviz.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.