jepegit / cellpy

extract and tweak data from electrochemical tests of cells
MIT License
88 stars 31 forks source link

Cannot create journal in Cellpy 1.0.0post6 #267

Closed johnphd closed 11 months ago

johnphd commented 1 year ago

Describe the bug In cellpy 1.x, which requires sqlalchemy 2.x and sqlalchemy-access the loader page has a command b.create_journal() which creates a journal used in all the processes in the rest of the notebook. The journal fails to be created for some reason.

To Reproduce Steps to reproduce the behavior. In the loader notebook, simply running through the steps. This can be the default copy installed with cellpy originally

Paste the command(s) you ran and the output.
b.create_journal()

If there was a crash, please include the traceback here.
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
[c:\scripting\cellpy_data\notebooks\2nd_Life\LOT_592\01_manual_loader_592A_capmass.ipynb](file:///C:/scripting/cellpy_data/notebooks/2nd_Life/LOT_592/01_manual_loader_592A_capmass.ipynb) Cell 17 line 1
----> [1](vscode-notebook-cell:/c%3A/scripting/cellpy_data/notebooks/2nd_Life/LOT_592/01_manual_loader_592A_capmass.ipynb#X22sZmlsZQ%3D%3D?line=0) b.create_journal()

File [c:\Users\user\.conda\envs\my_environment\Lib\site-packages\cellpy\utils\batch.py:612](file:///C:/Users/user/.conda/envs/my_environment/Lib/site-packages/cellpy/utils/batch.py:612), in Batch.create_journal(self, description, from_db, auto_use_file_list, file_list_kwargs, **kwargs)
    [608](file:///C:/Users/user/.conda/envs/my_environment/Lib/site-packages/cellpy/utils/batch.py:608)         logging.critical("This can be done by setting the correct parameters in "
    [609](file:///C:/Users/user/.conda/envs/my_environment/Lib/site-packages/cellpy/utils/batch.py:609)                          "the prms-file or by providing the correct kwargs "
    [610](file:///C:/Users/user/.conda/envs/my_environment/Lib/site-packages/cellpy/utils/batch.py:610)                          "(e.g. b.create_journal(auto_use_file_list=False)).")
    [611](file:///C:/Users/user/.conda/envs/my_environment/Lib/site-packages/cellpy/utils/batch.py:611)         raise e
--> [612](file:///C:/Users/user/.conda/envs/my_environment/Lib/site-packages/cellpy/utils/batch.py:612) self.experiment.journal.from_db(**kwargs)
    [613](file:///C:/Users/user/.conda/envs/my_environment/Lib/site-packages/cellpy/utils/batch.py:613) self.experiment.journal.to_file(
    [614](file:///C:/Users/user/.conda/envs/my_environment/Lib/site-packages/cellpy/utils/batch.py:614)     duplicate_to_local_folder=duplicate_to_local_folder
    [615](file:///C:/Users/user/.conda/envs/my_environment/Lib/site-packages/cellpy/utils/batch.py:615) )
    [617](file:///C:/Users/user/.conda/envs/my_environment/Lib/site-packages/cellpy/utils/batch.py:617) # TODO: remove these:

File [c:\Users\user\.conda\envs\my_environment\Lib\site-packages\cellpy\utils\batch_tools\batch_journals.py:188](file:///C:/Users/user/.conda/envs/my_environment/Lib/site-packages/cellpy/utils/batch_tools/batch_journals.py:188), in LabJournal.from_db(self, project, name, batch_col, **kwargs)
    [185](file:///C:/Users/user/.conda/envs/my_environment/Lib/site-packages/cellpy/utils/batch_tools/batch_journals.py:185)     self.name = name
    [186](file:///C:/Users/user/.conda/envs/my_environment/Lib/site-packages/cellpy/utils/batch_tools/batch_journals.py:186) logging.debug(f"batch_name, batch_col: {name}, {batch_col}")
--> [188](file:///C:/Users/user/.conda/envs/my_environment/Lib/site-packages/cellpy/utils/batch_tools/batch_journals.py:188) if self.db_reader is not None:
    [189](file:///C:/Users/user/.conda/envs/my_environment/Lib/site-packages/cellpy/utils/batch_tools/batch_journals.py:189)     if isinstance(self.db_reader, dbreader.Reader):  # Simple excel-db
    [190](file:///C:/Users/user/.conda/envs/my_environment/Lib/site-packages/cellpy/utils/batch_tools/batch_journals.py:190)         id_keys = self.db_reader.select_batch(name, batch_col)

AttributeError: 'LabJournal' object has no attribute 'db_reader'

Expected behavior Journal is created so that all other features of cellpy can be used (graphing, analytics, etc)

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

downgraded Cellpy to 0.4.3a3, and I have downgraded sqlalchemy to 1.4.50, error disappeared.

jepegit commented 11 months ago

The bug seems to have been handled in newer cellpy versions. Closing for now.