aquadk / google-diff-match-patch

Automatically exported from code.google.com/p/google-diff-match-patch
Apache License 2.0
0 stars 0 forks source link

Python implementation cannot be imported as a module #23

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Please provide any additional information below.

First of all, thank you for your great work on this library.

I would like to be able to import the Python implementation as a module so
that I can keep a checkout of the python folder in our common directory
(which is on every system's Python path). If it functioned as a module,
then I wouldn't have to modify all Python paths and treat diff_match_patch
as an edge-case (it could just be checked out directly in the common, or
any folder on the path, and it will Just Work). This will also work for
anyone else who has a common directory already on their path and wants to
use diff_match_patch without modification of their path or creation of
symlinks.

Fix:

Create __init__.py in the python directory, with this inside:

from .diff_match_patch import diff_match_patch, patch_obj

As I understand it (via http://www.python.org/dev/peps/pep-0328/), this
relative import syntax should be compatible with 2.4 or greater. Thanks!

Original issue reported on code.google.com by mike.fot...@gmail.com on 28 Aug 2009 at 4:29

GoogleCodeExporter commented 8 years ago
Done.  Thanks!

Original comment by neil.fra...@gmail.com on 4 Sep 2009 at 11:44

GoogleCodeExporter commented 8 years ago
Thanks, Neil!

Original comment by mike.fot...@gmail.com on 5 Sep 2009 at 12:02