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

AttributeError on serializing database #15

Open
thomas-daniels opened this issue Jun 4, 2023 · 0 comments
Open

AttributeError on serializing database #15

thomas-daniels opened this issue Jun 4, 2023 · 0 comments

Comments

@thomas-daniels
Copy link

Python 3.11.3, on the working branch.

I initially came across this error when running the wikimovies experiment, but it is reproducible with a minimal example:

from tensorlog import comline
db = comline.parseDBSpec("inputs/train-250.cfacts")
db.serialize("test.db")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/thomas/.local/lib/python3.11/site-packages/tensorlog-1.2.5-py3.11.egg/tensorlog/matrixdb.py", line 314, in serialize
    self.serializeDataTo(os.path.join(direc,"db.mat"))
  File "/home/thomas/.local/lib/python3.11/site-packages/tensorlog-1.2.5-py3.11.egg/tensorlog/matrixdb.py", line 329, in serializeDataTo
    self._saveMatDictWithScipy(fileLike,d)
  File "/home/thomas/.local/lib/python3.11/site-packages/tensorlog-1.2.5-py3.11.egg/tensorlog/matrixdb.py", line 348, in _saveMatDictWithScipy
    scipy.io.savemat(fileLike,d,do_compression=True)
  File "/usr/lib/python3.11/site-packages/scipy/io/matlab/_mio.py", line 300, in savemat
    MW.put_variables(mdict)
  File "/usr/lib/python3.11/site-packages/scipy/io/matlab/_mio5.py", line 884, in put_variables
    self._matrix_writer.write_top(var, name.encode('latin1'), is_global)
                                       ^^^^^^^^^^^
AttributeError: 'tuple' object has no attribute 'encode'

(This also happens with cfacts files that are a lot more trivial than the wikimovies one, so it does not appear to be database-specific.)

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

No branches or pull requests

1 participant