caltechlibrary / foliage

Foliage is the FOLIo chAnGe Editor, a tool to do bulk changes in FOLIO using the network API.
https://caltechlibrary.github.io/foliage
Other
10 stars 3 forks source link

ImportError: cannot import name 'put_scope' from 'pywebio.output' #1

Open rvhewitt opened 2 years ago

rvhewitt commented 2 years ago

I am unable to run Foliage 1.2.4 due to an import error. Installed via pipx

C:\windows\system32>foliage Traceback (most recent call last): File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3312.0_x64qbz5n2kfra8p0\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3312.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\rhewitt.local\bin\foliage.exe\main.py", line 4, in File "C:\Users\rhewitt.local\pipx\venvs\foliage\lib\site-packages\foliage\main__.py", line 166, in from foliage.change_tab import ChangeTab File "C:\Users\rhewitt.local\pipx\venvs\foliage\lib\site-packages\foliage\change_tab.py", line 26, in from pywebio.output import put_column, put_scope, clear_scope ImportError: cannot import name 'put_scope' from 'pywebio.output' (C:\Users\rhewitt.local\pipx\venvs\foliage\lib\site-packages\pywebio\output.py)

Regards, rvhewitt

mhucka commented 2 years ago

Hi – it might be that recent versions of pywebio have changed. I ended up using a private copy because I had to make a couple of changes to make it all work. I should probably put up a fork of pywebio if people are actually going to try to use Foliage outside of our group!

mhucka commented 2 years ago

Update: after spending some time on this, I think it would be difficult for other users to deal with a fork of PyWebIo. So, I'm going to work on submitting pull requests to the PyWebIo maintainers for the changes I made, to try to get them into the main release.

rvhewitt commented 2 years ago

Thank you, that will be much appreciated.

mhucka commented 2 years ago

Update: I finally found at least a temporary solution to the problem with PyWebIO. I created a fork of a snapshot of the PyWebIO GitHub repository and put my (very few) changes in it. Now the installation can be done using a 2-step approach:

python3 -m pip install git+https://github.com/mhucka/PyWebIO.git@2af53fc
python3 -m pip install foliage

However, in working on this, I realized that it may not be that easy to use Foliage at a non-Caltech site, because of baked-in assumptions about Caltech's FOLIO contents and identifier patterns used in FOLIO records :-). So, while it should be possible to install and start Foliage now, it will probably not do much for most people until those assumptions are moved to some kind of configuration file. I'm sorry about that. I'll open an issue to remind us that this is a problem, but I'm not sure when we will be able to get to fixing it.