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

"BadZipFile: File is not a zip file" Error Message #36

Closed
tieguyny opened this issue Sep 7, 2022 · 7 comments
Closed

"BadZipFile: File is not a zip file" Error Message #36

tieguyny opened this issue Sep 7, 2022 · 7 comments

Comments

@tieguyny
Copy link

tieguyny commented Sep 7, 2022

Hi, I went through all the steps, and when I ask it to "dream" I get a popup error message, here are the contents:

BadZipFile
Python 3.8.1: C:\Program Files\Krita (x64)\bin\krita.exe
Tue Sep 6 23:31:46 2022

A problem occurred in a Python script. Here is the sequence of
function calls leading up to the error, in the order they occurred.

C:\Users\Desktop\AppData\Roaming\krita\pykrita\koi\koi.py in pingServer(self=<koi.koi.Koi object>)
157 # wait for response and read image
158 with request.urlopen(response_url, timeout=self._get_timeout()) as response:
159 archive = ZipFile(BytesIO(response.read()))
160 filenames = archive.namelist()
161 for name in filenames:
archive undefined
global ZipFile = <class 'zipfile.ZipFile'>
global BytesIO = <class '_io.BytesIO'>
response = <http.client.HTTPResponse object>
response.read = <bound method HTTPResponse.read of <http.client.HTTPResponse object>>

C:\Program Files\Krita (x64)\zipfile.py in init(self=<zipfile.ZipFile [closed]>, file=<_io.BytesIO object>, mode='r', compression=0, allowZip64=True, compresslevel=None, strict_timestamps=True)

C:\Program Files\Krita (x64)\zipfile.py in _RealGetContents(self=<zipfile.ZipFile [closed]>)

BadZipFile: File is not a zip file
cause = None
class = <class 'zipfile.BadZipFile'>
context = None
delattr = <method-wrapper 'delattr' of BadZipFile object>
dict = {}
dir =
doc = None
eq = <method-wrapper 'eq' of BadZipFile object>
format =
ge = <method-wrapper 'ge' of BadZipFile object>
getattribute = <method-wrapper 'getattribute' of BadZipFile object>
gt = <method-wrapper 'gt' of BadZipFile object>
hash = <method-wrapper 'hash' of BadZipFile object>
init = <method-wrapper 'init' of BadZipFile object>
init_subclass =
le = <method-wrapper 'le' of BadZipFile object>
lt = <method-wrapper 'lt' of BadZipFile object>
module = 'zipfile'
ne = <method-wrapper 'ne' of BadZipFile object>
new =
reduce =
reduce_ex =
repr = <method-wrapper 'repr' of BadZipFile object>
setattr = <method-wrapper 'setattr' of BadZipFile object>
setstate =
sizeof =
str = <method-wrapper 'str' of BadZipFile object>
subclasshook =
suppress_context = False
traceback =
weakref = None
args = ('File is not a zip file',)
with_traceback =

The above is a description of an error in a Python program. Here is
the original traceback:

Traceback (most recent call last):
File "C:\Users\Desktop\AppData\Roaming\krita\pykrita\koi\koi.py", line 159, in pingServer
archive = ZipFile(BytesIO(response.read()))
File "zipfile.py", line 1267, in init
File "zipfile.py", line 1334, in _RealGetContents
zipfile.BadZipFile: File is not a zip file

I really have no idea what to do, I appreciate any help you can offer!

@johantri
Copy link

johantri commented Sep 7, 2022

Same here. I'm following the video tutorial from here https://www.youtube.com/watch?v=M2R-tsZglaY

@Lewington-pitsos
Copy link
Contributor

Lewington-pitsos commented Sep 7, 2022

hey guys, that can mean one of 2 things:

(1) something went wrong with the backend (colab or local) and it's returning an error instead of the usual zipfile. This can happen if your ngrok trial-thing runs out or if the colab backend has disconnected. First thing to do is look at what happens on the backend whenever you get that error.

(2) you are running the new version of the plugin (which expects a zip file) but an old version of the backend (which serves single images). Check the code which is running your backend (e.g. the colab notebook) to see if it contains any mention of a "zipfile". If so, you're fine, if not you will need to download (i.e. pull the latest master) a newer version of the backend and use that instead.

Hope this helps.

@Lewington-pitsos
Copy link
Contributor

I have found an issue where if you are using the local backend, zipfiles are not being sent as they should be. In order to fix this, you have to use the version of server.py from this branch of my own personal fork.

I have verified that the fix works on my own local computer.

or wait for the main branch of this repo to be updated to include that fix and pull it then (this should be within the next 12 hours) @nousr can you post here when this fix has occurred.

NOTE: if you are using colab this issue will not be effecting you, and you are possibly using an outdated version of the colab backend. The one on main now will not experience the zip issue.

@nousr
Copy link
Owner

nousr commented Sep 7, 2022

@tieguyny @johantri @Lewington-pitsos

should be fixed, feel free to re-open if more issues occur

@nousr nousr closed this as completed Sep 7, 2022
@Syannako
Copy link

Syannako commented Sep 7, 2022

I am getting the zip-file error as well. I am using colab and I just cloned from master half an hour ago.
I don't see how it could be an outdated version.

EDIT: I traced it to a runtime error on the back-end, related to memory allocation of CUDA. I managed to sidestep it by reducing the image resolution significantly.

@nousr
Copy link
Owner

nousr commented Sep 7, 2022

@Syannako I pushed an update that will hopefully lower the VRAM requirements.

If you run into more issues it seems like there's one more option we can go with, although I don't know how it will affect the speed.

lmk

@johantri
Copy link

johantri commented Sep 8, 2022

Thank you @nousr @Lewington-pitsos it works now!

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

5 participants