Code Monkey home page Code Monkey logo

python-stripzip's Issues

NameError: name 'xrange' is not defined (Python 3 compatibility

when I run stripzip I'm getting this error.

Traceback (most recent call last):
  File "/Users/patrickc/Library/Python/3.6/bin/stripzip", line 8, in <module>
    sys.exit(cli())
  File "/Users/patrickc/Library/Python/3.6/lib/python/site-packages/stripzip.py", line 123, in cli
    _zero_zip_date_time(zip_)
  File "/Users/patrickc/Library/Python/3.6/lib/python/site-packages/stripzip.py", line 96, in _zero_zip_date_time
    purify_extra_data(mm, offset-extra_field_length-compressed_size, extra_field_length)
  File "/Users/patrickc/Library/Python/3.6/lib/python/site-packages/stripzip.py", line 36, in purify_extra_data
    for i in xrange(2, len(values)):
NameError: name 'xrange' is not defined

stack overflow says this is a python 2->3 compatibility issue. https://stackoverflow.com/questions/17192158/nameerror-global-name-xrange-is-not-defined-in-python-3

stripzip should also strip access time, uid and gid

Thanks for writing this tool!

For me, stripzip (as installed from pypi) resets file modification time (yay!) but leaves access time, uid and gid attributes.

Here's an example from MacOS, diff between 2 runs of (zip + stripzip):

--- details.1s.txt	2018-11-14 17:29:46.000000000 +0900
+++ details.2s.txt	2018-11-14 17:30:32.000000000 +0900
@@ -15,7 +15,7 @@
 0028   Length              0009
 002A   Flags               '03 mod access'
 002B   Mod Time            5BE94512 'Mon Nov 12 18:17:06 2018'
-002F   Access Time         5BEBDCB6 'Wed Nov 14 17:28:38 2018'
+002F   Access Time         5BEBDD12 'Wed Nov 14 17:30:10 2018'
 0033 Extra ID #0002        7875 'ux: Unix Extra Type 3'
 0035   Length              000B
 0037   Version             01
@@ -41,7 +41,7 @@
 006F   Length              0009
 0071   Flags               '03 mod access'
 0072   Mod Time            5BE3EA30 'Thu Nov  8 16:48:00 2018'
-0076   Access Time         5BEBDCB6 'Wed Nov 14 17:28:38 2018'
+0076   Access Time         5BEBDD12 'Wed Nov 14 17:30:10 2018'
 007A Extra ID #0002        7875 'ux: Unix Extra Type 3'
 007C   Length              000B
 007E   Version             01

Access times change because zip read the file, and uid/gid would depend on who ran zip.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.