Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: issues with save function #276

Closed
wants to merge 7 commits into from
Closed

fix: issues with save function #276

wants to merge 7 commits into from

Conversation

rich-iannone
Copy link
Member

@rich-iannone rich-iannone commented Apr 11, 2024

This adds a workflow job that tests whether the .save() method is properly producing a table image when using the "firefox" webdriver.

Also fixes: #241

@github-actions github-actions bot temporarily deployed to pr-276 April 11, 2024 17:32 Destroyed
@github-actions github-actions bot temporarily deployed to pr-276 April 11, 2024 17:33 Destroyed
python-version: "3.12"
- name: Install dependencies
run: |
pip install -e '.[extra]'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just run pip install pandas for now after this, since we need it for the datasets

@codecov-commenter
Copy link

codecov-commenter commented Apr 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.71%. Comparing base (ed09f9d) to head (c4bae56).
Report is 27 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #276      +/-   ##
==========================================
- Coverage   81.72%   81.71%   -0.01%     
==========================================
  Files          41       41              
  Lines        4323     4321       -2     
==========================================
- Hits         3533     3531       -2     
  Misses        790      790              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions github-actions bot temporarily deployed to pr-276 April 11, 2024 18:53 Destroyed
@rich-iannone
Copy link
Member Author

This fails with:

python .github/scripts/save_browser_table.py
Traceback (most recent call last):
  File "/home/runner/work/great-tables/great-tables/.github/scripts/save_browser_table.py", line 3, in <module>
    GT(exibble).save("exibble_firefox.png", web_driver="firefox")
  File "/home/runner/work/great-tables/great-tables/great_tables/_export.py", line 181, in save
    wdriver(options=wd_options) as headless_browser,
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/selenium/webdriver/firefox/webdriver.py", line 69, in __init__
    super().__init__(command_executor=executor, options=options)
  File "/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 208, in __init__
    self.start_session(capabilities)
  File "/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 292, in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 347, in execute
    self.error_handler.check_response(response)
  File "/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Process unexpectedly closed with status 1

make: *** [Makefile:53: save-browser-table] Error 1

Probably because Firefox is run in non-headless mode: https://stackoverflow.com/questions/46809135/webdriver-exceptionprocess-unexpectedly-closed-with-status-1

Now, technically it runs in headless mode on my system but the resulting image is incorrect (only gives correct image output when not run in headless mode).

@rich-iannone
Copy link
Member Author

I suppose we could instead run with chrome using: https://github.com/browser-actions/setup-chrome.

@machow
Copy link
Collaborator

machow commented Apr 11, 2024

Ah, dang--what does the image look like? It looks there are options to run FF headless in that SO post and this one, so I'm curious if there's a way to get it to work?!

@rich-iannone
Copy link
Member Author

The firefox screenshot looks like this in headless mode:

test-firefox

and otherwise just fine if we run w/o headless:

test-firefox_not_headless

I'll try out some of the things in that SO post to see if there's a way to work around this!

@rich-iannone
Copy link
Member Author

Seems like "---headless=new" solved the problem! See https://www.selenium.dev/blog/2023/headless-is-going-away/. I'll test this with the rest of the web drivers to ensure everything works with that.

@rich-iannone
Copy link
Member Author

With "---headless=new" all four browsers now work well in headless mode. Pushed the change.

@github-actions github-actions bot temporarily deployed to pr-276 April 11, 2024 20:58 Destroyed
@github-actions github-actions bot temporarily deployed to pr-276 April 17, 2024 20:14 Destroyed
@machow machow changed the title Quick fixes to code base (from code pairing) fix: issues with save function Apr 17, 2024
@machow
Copy link
Collaborator

machow commented May 15, 2024

  • [ ]

@machow machow closed this May 15, 2024
@rich-iannone rich-iannone deleted the quick-fixes branch May 24, 2024 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove mentions of 'Accounting' format in docs
3 participants