Closed syncrostone closed 3 years ago
Are you using the add_image command anywhere? If so, does removing this command fix the problem?
I'm not using the add_image command, but I am using imshow, I tried removing that and it still gets the same error.
I do use add_colorbar, add_grid and add_figure_labels.
Looks like the new version of PyMuPDF introduced a new function argument which was required to be set to something different than the default. Should be fixed with this commit.
I started getting the same error now. It didn't use to be and I do not remember doing anything except for updating my packages but now I'm getting:
---> 36 c.save(os.path.join(path_results, 'random.pdf'), dpi=150, bbox_inches="tight")
37
38
~/anaconda3/lib/python3.8/site-packages/paranoid/decorators.py in _decorated(*args, **kwargs)
124 _check_accepts(func, argvals)
125 _check_requires(func, argvals)
--> 126 returnvalue = func(*args, **kwargs)
127 _check_returns(func, returnvalue)
128 _check_ensures(func, returnvalue, argvals)
~/anaconda3/lib/python3.8/site-packages/CanD-0.0.1-py3.8.egg/cand/canvas.py in save(self, filename, dpi, *args, **kwargs)
857 pdf.metadata['producer'] = f"{_idstr}; {pdf.metadata['producer']}"
858 pdf.setMetadata(pdf.metadata)
--> 859 pdf.save(pdf.name, deflate=True, incremental=True)
860 pdf.close()
861 @pns.accepts(pns.Self, Vector, Point)
~/anaconda3/lib/python3.8/site-packages/fitz/fitz.py in save(self, filename, garbage, clean, deflate, deflate_images, deflate_fonts, incremental, ascii, expand, linear, pretty, encryption, permissions, owner_pw, user_pw)
4268 raise ValueError("incremental needs original file")
4269
-> 4270 return _fitz.Document_save(
4271 self,
4272 filename,
RuntimeError: Can't do incremental writes when changing encryption
nevertheless, the pdf is still produced. For fitz
, I have:
Type: module
String form: <module 'fitz' from '/Users/jan/anaconda3/lib/python3.8/site-packages/fitz/__init__.py'>
File: ~/anaconda3/lib/python3.8/site-packages/fitz/__init__.py
Docstring:
PyMuPDF 1.18.9: Python bindings for the MuPDF 1.18.0 library.
Version date: 2021-02-26 13:46:32.
Built for Python 3.8 on darwin (64-bit).
This bug was fixed in the latest version of CanD, which isn't on pip yet. Try installing directly from the github repo. It is due to PyMuPDF changing the names of some function arguments.
Hi @mwshinn, in which version was it fixed? I have now 0.0.1
and I was installing it directly from your repo, I did not use pip (and for my last update I also did not use pip but rather conda).
I have not yet incremented the version yet, so both the fixed version and the unfixed version are version 0.0.1. :/ Conda will install the version from pip which is outdated. To install from github, download the repo (either using git clone or else by downloading the zip from github) and run "python setup.py install --force".
This might be a stupid question but I'm not sure how exactly it works. I have your repo forked and have a pull request there (sorry, I didn't have much time to finish it and a lot of deadlines lately it but next month should work...) and I'm unsure what will happen to it if I reinstall. Also, shouldn't it just get updated by itself if I pull it? Or what's the correct and proper way of doing it?
Okay, I just incremented the version to 0.0.2 so you can install from pip if you would like. Hopefully that makes things easier!
I get this issue when I save as a pdf. It seems to save anyhow, but I'm not sure why I’m getting it: