Skip to content

table show_in_browser() broken #17512

Closed

Description

@hamogu

Description

I can't open table with the show_in_brower method.

Expected behavior

Open a browser window or display a useful error

How to Reproduce

  1. create fresh environment
  2. install astropy and python with pip (pip install astropy ipython)
In [1]: from astropy.table import Table

In [2]: tab = Table({"a": [1,2], "asdf":['wer', 'sdf']})

In [3]: tab.show_in_browser()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[3], line 1
----> 1 tab.show_in_browser()

File ~/mambaforge/envs/deleteme/lib/python3.13/site-packages/astropy/utils/decorators.py:140, in deprecated.<locals>.deprecate_function.<locals>.deprecated_func(*args, **kwargs)
    136     category = warning_type
    138 warnings.warn(message, category, stacklevel=2)
--> 140 return func(*args, **kwargs)

File ~/mambaforge/envs/deleteme/lib/python3.13/site-packages/astropy/table/table.py:1925, in Table.show_in_browser(self, max_lines, jsviewer, browser, jskwargs, tableid, table_class, css, show_row_index)
   1923     log.error(f"Browser '{browser}' not found.")
   1924 else:
-> 1925     br.open(urljoin("file:", pathname2url(path)))

File ~/mambaforge/envs/deleteme/lib/python3.13/urllib/request.py:1673, in pathname2url(pathname)
   1670 def pathname2url(pathname):
   1671     """OS-specific conversion from a file system path to a relative URL
   1672     of the 'file' scheme; not recommended for general use."""
-> 1673     if pathname[:2] == '//':
   1674         # Add explicitly empty authority to avoid interpreting the path
   1675         # as authority.
   1676         pathname = '//' + pathname
   1677     encoding = sys.getfilesystemencoding()

TypeError: 'PosixPath' object is not subscriptable

Versions

platform
--------
platform.platform() = 'macOS-15.0.1-arm64-arm-64bit-Mach-O'
platform.version() = 'Darwin Kernel Version 24.0.0: Tue Sep 24 23:36:26 PDT 2024; root:xnu-11215.1.12~1/RELEASE_ARM64_T8103'
platform.python_version() = '3.13.1'

packages
--------
astropy              7.0.0
numpy                2.1.3
scipy                --
matplotlib           --
pandas               --
pyerfa               2.0.1.5

Activity

  1. neutrinoceros commented on Dec 6, 2024

    @neutrinoceros
    Contributor

    That's very likely on me. I'll look into it now

  2. hamogu commented on Dec 6, 2024

    @hamogu
    MemberAuthor

    I found it in #17480. I don't think it intersects, but an interesting data point is: Nobody complained about it in the last few days and I only found it because I'm working on a related feature, so maybe the show_in_browser is not that regularly used. (Nothing better than breaking something to find out is users care for the functionality).

  3. Cadair commented on Jan 7, 2025

    @Cadair
    Member

    Just to make the point, I found this while using table "in the wild".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions