Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing icdiff module to my python code is giving error #46

Closed
Jainpriyal opened this issue Mar 16, 2015 · 4 comments
Closed

Importing icdiff module to my python code is giving error #46

Jainpriyal opened this issue Mar 16, 2015 · 4 comments

Comments

@Jainpriyal
Copy link

Hi,

I have installed icdiff in Mac, its working fine from terminal. But when I am importing it in my python code it is giving error.

ImportError: No module named icdiff

How to import this module, is it not supported ??

@jeffkaufman
Copy link
Owner

The easiest way to import icdiff is to add it's containing directory to sys.path:

import sys
sys.path.append("/containing/directory ")
import icdiff

@vnitinv
Copy link

vnitinv commented Mar 24, 2015

for what you said, icdiff need to be a .py file. Then only it can be imported.

nitinkr-mba13:ex nitinkr$ which icdiff
/Library/Frameworks/Python.framework/Versions/2.7/bin/icdiff
nitinkr-mba13:ex nitinkr$ python
Python 2.7.8 (v2.7.8:ee879c0ffa11, Jun 29 2014, 21:07:35)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

import sys
sys.path.append(r'/Library/Frameworks/Python.framework/Versions/2.7/bin')
import icdiff
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named icdiff

@jeffkaufman
Copy link
Owner

That's fine: rename or symlink it to icdiff.py.

@jeffkaufman
Copy link
Owner

Also, depending on what you're trying to do, consider Python's built in Difflib.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants