Python module not working (not able to import) even after including it in PATH variable

I have one testing module that I want to use for android testing. I have the files but there is no installation file for it, so I added the module to PATH variable, even then it doesn't work I try to import it.

Any way to make it work. Do I have to paste them in Python folder only (and what it the Python file location). In windows, I use to paste all the files in Python folder and everything works perfectly fine. Here in Ubuntu I'm not able to find the location so I added it in PATH.

Any way out! Any help is appreciated.

Cheers

Some details: Python version: 2.7.2, Ubuntu 11.10 OS, Python module is in file/folder format with no "setup.py" file to install, Location of module already in PATH variable, Everything else in Python is working beside that module, same worked in Windows XP with Python 2.7.2 after copy pasting.

-------------Problems Reply------------

PATH is for executables, PYTHONPATH is for Python modules.

You can also start your script with:

import sys
sys.path.append('/path/to/directory')
import your_module

Where /path/to/directory/your_module.py is the file you're importing.

The normal location for Python modules is in /usr/lib/pythonX.X/site-packages. For installing stuff as a user virtualenv is great.

Category:python Views:0 Time:2012-02-04
Tags: python

Related post

  • Accessing Python module fails although its package is imported 2010-04-13

    My Django project's directory hierarchy looks like this: + pybsd |---+ devices |---+ templates |---+ views |---+ interaction |---- __init__.py |---- geraete.py |---- geraetemodelle.py |---- geraetegruppen.py |---- __init__.py |---- ajax.py |---- html

  • Is it possible to utilize a python module that isnt installed into the python directories in linux? 2009-07-31

    I have a python application that depends on the uuid module, but on the server where I need to run it, uuid is not installed. I do not have root on the server so I cannot place the uuid .pys in the /usr/lib/python2.4/site-packages folder... is there

  • Catching C++ exceptions when multiple Python modules share one C++ .so 2012-04-13

    I have a piece of python code that's structured like this: import A import B A.throw() B.throw() Both A and B are modules written in C++. When I compile them, both of them link to a common library exception.so, which includes an exception and a funct

  • Access to aliased functions in a Python module 2010-08-20

    I am consolidating many shell-like operations into a single module. I would then like to be able to do: pyscript.py: from shell import * basename("/path/to/file.ext") and the shell.py module contains: shell.py: from os.path import basename The proble

  • Importing Python modules from different working directory 2009-06-25

    I have a Python script that uses built-in modules but also imports a number of custom modules that exist in the same directory as the main script itself. For example, I would call python agent.py and agent.py has a number of imports, including: impor

  • How to import python module in a shared folder? 2009-07-28

    I have some python modules in a shared folder on a Windows machine. The file is \mtl12366150\test\mymodule.py os.path.exists tells me this path is valid. I appended to sys.path the folder \mtl12366150\test (and os.path.exists tells me this path is va

  • Importing Python modules from a distant directory 2009-10-15

    What's the shortest way to import a module from a distant, relative directory? We've been using this code which isn't too bad except your current working directory has to be the same as the directory as this code's or the relative path breaks, which

  • How to de-import a Python module? 2009-11-03

    I am in the process of coding an app which has to get the metadata (author,version..etc) out of several modules (.py files) and display them. The user selects a script and the script is executed. (New scripts can be added and old ones be taken of fro

  • Find which python modules are being imported 2010-01-04

    What's an easy way of finding all the python modules from a particular package that are being used in an application? --------------Solutions------------- sys.modules is a dictionary mapping module names to modules. You can examine its keys to see im

  • Import a python module without the .py extension 2010-04-08

    I have a file called foobar (without .py extension). In the same directory I have another python file that tries to import it: import foobar But this only works if I rename the file to foobar.py. Is it possible to import a python module that doesn't

  • Python modules import error 2010-05-23

    Very strange for me: # uname -a Linux localhost.localdomain 2.6.18-194.3.1.el5 #1 SMP Thu May 13 13:09:10 EDT 2010 i686 i686 i386 GNU/Linux # pwd /root # python Python 2.6.5 (r265:79063, Apr 11 2010, 22:34:44) [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)]

  • Trouble importing a Python module 2010-05-25

    I have a Python project with 2 files: epic.py site.py in the epic.py I have the lines from site import * bark() in site.py I have the lines def bark(): print('arf!') when I try to run epic.py, it returns "bark is not defined" this is weird. ---------

  • Importing Python modules without installing - Sybase ASE 2010-06-08

    I need to use the Sybase Python module but our SA's won't install because it's not in the repo's. I've downloaded it and placed it on the box and would just like to 'import' or 'include' the module without installing it first. - Is this possible? Fro

  • Python Module Importing Issues 2010-08-15

    I run Windows 7, and I can import built-in modules, but when I save my own script and try to import it in IDLE, I get an error saying that the module doesn't exist. I use the Python text editor found by clicking "File" and "New Window" from the Pytho

  • Why do Python modules sometimes not import their sub-modules? 2010-09-23

    I noticed something weird today I would like explained. I wasn't 100% sure how to even phrase this as a question, so google is out of the question. The logging module does not have access to the module logging.handlers for some odd reason. Try it you

  • Dynamically importing Python module 2010-09-26

    I have a trusted remote server that stores many custom Python modules. I can fetch them via HTTP (e.g. using urllib2.urlopen) as text/plain, but I cannot save the fetched module code to the local hard disk. How can I import the code as a fully operab

  • Python Module Import Error "ImportError: No module named mrjob.job" 2010-11-16

    System: Mac OSX 10.6.5, Python 2.6 I try to run the python script below: from mrjob.job import MRJob class MRWordCounter(MRJob): def mapper(self, key, line): for word in line.split(): yield word, 1 def reducer(self, word, occurrences): yield word, su

  • django apache mod-wsgi hangs on importing a python module from .so file 2010-11-21

    I'm trying to deploy a django application for production on apache mod-wsgi. I have a third party python application called freecad which packages python module in an FreeCAD.so library file. Requests hang on 'import FreeCAD'. Some apache log errors

  • What could cause a python module to be imported twice? 2011-01-25

    As far as I understand, a python module is never imported twice, i.e. the code in the module only gets executed the first time it is imported. Subsequent import statements just add the module to the scope of the import. I have a module called "TiledC

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.136 (s). 11 q(s)