Download Latest Version pymtpc.tgz (25.0 kB)
Email in envelope

Get an email when there's a new version of py3mtp

Home
Name Modified Size InfoDownloads / Week
README 2015-08-16 1.9 kB
pymtpc.tgz 2015-08-16 25.0 kB
pymtpb.tgz 2015-08-15 32.5 kB
pymtpa.tgz 2015-08-15 23.9 kB
Totals: 4 Items   83.2 kB 3
PyMTP is a Pythonic binding to LibMTP that allows Python programs to interact
over Media Transfer Protocol (MTP) with LibMTP-supported devices. 

pymtp is an excellent library to link python and libmtp to access mtp devices. The version 0.0.6 created by Nick Devito (https://pypi.python.org/pypi/PyMTP ) works only with python2.

This is an attempt to migrate to python3.

step A:
    The original code was had tabs for identation.
    This includes the example programs.
    Meanwhile is has become the standard to use 4 spaces.
    i've created a small program to change all tabs to spaces.
    In total 2441 tabs have been replaced by spaces.

step B:
    The original code was not really pep8 compliant.
    Used pep8 to check the files.
    Many errors regarding whitespace, 
        double blockcomment, blank lines between functions
        continuation line indentation, backslash between brackets.
    These micro-errors are easy fixed.
    And few lines where a more modern python style should be used:
    - "if item == None:"     should be  "if item is None:"
    - "if item != None:"     should be  "if device is not None:"
    - "if adict.has_key(k):" is deprecated, use  "if k in adict:"

step C:
    Finally we go to python 3 using 2to3 on all python files.
    The majority of changes is in the print function.
    A few lines where  "xrange"  is changed to  "range".
    These lines looks strange to me:
        OLD next = next.contents.next
        NEW next = next.contents.__next__
    Than we must:
    - update README as it can no longer run on python 2.
    - check the changes for issues and obvious bugs.
    - update setup.py and PKG-INFO
        Since we had no functional change,
        we maintain the original version 0.0.6 and all other text.
        To indicate a difference try: version = "0.0.6c"

step D: TODO
    Testing & debugging.

Source: README, updated 2015-08-16