Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

UnboundLocalError: local variable 'zipped_f' referenced before assignment #7

Closed
cmungall opened this issue Mar 28, 2021 · 0 comments
Closed
Assignees

Comments

@cmungall
Copy link
Member

the variable zipped_f is only set if -a is passed AND the file does not end with .zip

    if archive and not archive.endswith(".zip"):
        archive += ".zip"
        zipped_f = zipfile.ZipFile(archive, 'w')

so if I say python3 ttl2sif.py -i examples -a gocam-sif.zip -g

it will get to this section

            if archive:
                zpf = zipped_f.open("gocam-sif/" + ttl_file[0:ttl_file.rfind(".")] + ".sif", "w")
                zpf.write(str.encode(sif_content))
                zpf.close()

and zipped_f will be unassigned, leading to the error

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants