Skip to content

Zip files created by git archive result in a SyntaxError (due to comment?) #66518

Closed

Description

@Lekensteyn
mannequin
BPO 22322
Nosy @bitdancer, @Lekensteyn
Superseder
  • bpo-5950: Make zipimport work with zipfile containing comments
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2014-09-01.16:26:14.359>
    created_at = <Date 2014-09-01.15:11:58.076>
    labels = ['extension-modules', 'type-bug']
    title = 'Zip files created by `git archive` result in a SyntaxError (due to comment?)'
    updated_at = <Date 2014-09-01.16:26:14.357>
    user = 'https://github.com/Lekensteyn'

    bugs.python.org fields:

    activity = <Date 2014-09-01.16:26:14.357>
    actor = 'r.david.murray'
    assignee = 'none'
    closed = True
    closed_date = <Date 2014-09-01.16:26:14.359>
    closer = 'r.david.murray'
    components = ['Extension Modules']
    creation = <Date 2014-09-01.15:11:58.076>
    creator = 'lekensteyn'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 22322
    keywords = []
    message_count = 2.0
    messages = ['226230', '226233']
    nosy_count = 2.0
    nosy_names = ['r.david.murray', 'lekensteyn']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '5950'
    type = 'behavior'
    url = 'https://bugs.python.org/issue22322'
    versions = ['Python 2.7', 'Python 3.4']

    Activity

    1. Lekensteyn commented on Sep 1, 2014

      Lekensteynmannequin
      MannequinAuthor

      Files created by git archive are not understood by the Python interpreter. This could be caused by the additional comment (for the commit hash) in the file.

      echo 'print(1)' > __main__.py
      git init && git add __main__.py && git commit -m init
      git archive --format=zip HEAD > y.zip
      python y.zip

      Packing it with zip x.zip __main__.py && python x.zip works.

    2. bitdancer commented on Sep 1, 2014

      @bitdancer
      Member

      You are correct. zipimport does not support zip files with comments. There is already an open issue (bpo-5950) for adding support for this.

    3. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      extension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions