Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install py7file

How to install py7file

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install py7file
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.7.4 Available View build log
0.7.2 Available View build log
0.7.1 Available View build log
0.7 Available View build log
0.6 Available View build log
0.5.1 Available View build log
0.4 Available View build log
0.2 Available View build log
Windows (64-bit)
0.7.4 Available View build log
0.7.2 Available View build log
0.7.1 Available View build log
0.7 Available View build log
0.6 Available View build log
0.5.1 Available View build log
0.4 Available View build log
0.2 Available View build log
Mac OS X (10.5+)
0.7.4 Available View build log
0.7.2 Available View build log
0.7.1 Available View build log
0.7 Available View build log
0.6 Available View build log
0.5.1 Available View build log
0.4 Available View build log
0.2 Available View build log
Linux (32-bit)
0.7.4 Available View build log
0.7.2 Available View build log
0.7.1 Available View build log
0.7 Available View build log
0.6 Available View build log
0.5.1 Available View build log
0.4 Available View build log
0.2 Available View build log
Linux (64-bit)
0.7.4 Available View build log
0.7.2 Available View build log
0.7.1 Available View build log
0.7 Available View build log
0.6 Available View build log
0.5.1 Available View build log
0.4 Available View build log
0.2 Available View build log
 
Author
License
BSD
Imports
Lastest release
version 0.7.4 on Nov 20th, 2011

Py7File wraps and unifies the python stdlib file handling modules with a simple and intuitive high-level api.

Installation

Use easy_install or pip:

pip install py7file

Usage

Here some hopefully self explaining examples of Py7File usage:

from py7file import Py7File

the_file = Py7File('a_file.txt')

# Copy and Move
copied_file = the_file.copy('d_file.txt')  # copied_file is also a Py7file
the_file.move('moved_file.txt')  # moves the file and mutates the reference

# Backup and Restore
the_file.backup()  # creates a_file_backup_001.txt
the_file.backup()  # creates a_file_backup_002.txt
the_file.delete()  # removes a_file.txt from disk (ups...)
the_file.restore() # recovers file from a_file_backup_002.txt

# Unzip and Rezip
zfile = Py7File('a_file.zip')
zfile.unzip() # creates a folder a_file_unzipped with contents of zipfile
zfile.rezip() # repackages subfolder a_file_unzipped to a_file.zip

See test_py7file.py for more examples.

Testing

Py7File is tested against python 2.6 and 2.7

To run the tests:

python test_py7file.py

Status

Well I am using this this file handling library quite extensivly myself and i got no complaints so far ;). Still please consider this Beta and use at your own risk...

Background

As I started learning programming with python I found the different modules for handling files very confusing and cumbersome to use. While writing my first scripts I found myself writing os.path.join(...) way to often. I still keep mixing up os and shutil based file operations like copy, move, rename. So I started this little module to make things easier...

News

0.7.4

  • fixed get_md5 to use internal filepath

0.7.3

  • .unzip() can now handle gzipped files transparently
  • .unzip() now returns a list containing all extracted files as Py7File objects
  • fixed filepath encoding

0.7.2

Release date: 15-August-2011

  • Added get_number() method for convenient work with numbered files.

0.7.1

Release date: 24-July-2011

  • fixed setup.py

0.7

Release date: 17-July-2011

  • added new get_sanitized_filename method

0.6

Release date: 21-May-2011

  • new EpubFile class that suports epub packaging
  • enhancements for Py7File subclassing

0.5.1

Release date: 10-May-2011

  • basic read method added
  • improved file comparison

0.5

Release date: 09-May-2011

  • fixed filepath property to always give absolute path

0.4

Release date: 08-May-2011

  • fixed to work with files that have no extension
  • fixed getsize test not returning long on osx
  • added md5 based file comparison
  • .is_binary() detects if file is binary or "text"

0.2

Release date: 08-May-2011

  • Fixed for tests on OSX

0.1

Release date: 08-May-2011

  • Initial release

Subscribe to package updates

Last updated Nov 20th, 2011

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.