tagged [python-import]
pytest cannot import module while python can
pytest cannot import module while python can I am working on a package in Python. I use virtualenv. I set the path to the root of the module in a .pth path in my virtualenv, so that I can import modul...
Unresolved Import Issues with PyDev and Eclipse
Unresolved Import Issues with PyDev and Eclipse I am very new to PyDev and Python, though I have used Eclipse for Java plenty. I am trying to work through some of the Dive Into Python examples and thi...
- Modified
- 23 Feb at 10:45
Import Script from a Parent Directory
Import Script from a Parent Directory How do I import a module(python file) that resides in the parent directory? Both directories have a `__init__.py` file in them but I still cannot import a file fr...
ImportError: No module named 'pygame'
ImportError: No module named 'pygame' I have installed python 3.3.2 and pygame 1.9.2a0. Whenever I try to import pygame by typing: import pygame I get following error message : ``` Python 3.3.2 (v3.3...
PyCharm import external library
PyCharm import external library I am using PyCharm as an editor for python code in Houdini. Whenever I try to import the main Houdini library (hou) I get an error flagged in PyCharm. If I include the ...
How to import .py file from another directory?
How to import .py file from another directory? I have this structure of files (directory and after arrow files): main `__init__.py`: model directory: report directory: now in `other_py_file` I want to...
- Modified
- 9 Apr at 07:29
How to do relative imports in Python?
How to do relative imports in Python? Imagine this directory structure: I'm coding `mod1`, and I need to import something from `mod2`. How should I do it? I tried `from ..sub2 import mod2` but I'm ge...
- Modified
- 16 Feb at 15:34
ImportError: No module named - Python
ImportError: No module named - Python I have a python application with the following directory structure: In the package , I have a python module named which has an import statement like: In order for...
How to dynamically load a Python class
How to dynamically load a Python class Given a string of a Python class, e.g. `my_package.my_module.MyClass`, what is the best possible way to load it? In other words I am looking for a equivalent `Cl...
- Modified
- 29 Sep at 21:27
Modifying a variable in a module imported using from ... import *
Modifying a variable in a module imported using from ... import * Consider the following code: As it seems, this creates one variable in each module with different content. How can I modify the variab...
- Modified
- 13 Sep at 20:6
Installing lxml module in python
Installing lxml module in python while running a python script, I got this error now I tried to install lxml but it gives me the following error ``` Building lxml version 2.3.beta1. NOTE: Trying to bu...
- Modified
- 26 May at 11:42
How to insert an image in python
How to insert an image in python how do you import or insert an image using python.Basically I want to know how to import an image and how to select the file and folder its in using python.
Sibling package imports
Sibling package imports I've tried reading through questions about sibling imports and even the [package documentation](http://docs.python.org/tutorial/modules.html#intra-package-references), but I've...
- Modified
- 25 Feb at 15:28
Importing a long list of constants to a Python file
Importing a long list of constants to a Python file In Python, is there an analogue of the `C` preprocessor statement such as?: `#define MY_CONSTANT 50` Also, I have a large list of constants I'd like...
- Modified
- 25 Feb at 15:26
Import module from subfolder
Import module from subfolder I want to import subfolders as modules. Therefore every subfolder contains a `__init__.py`. My folder structure is like this: In my main script I import In t
- Modified
- 21 Jan at 14:44
How to import or include data structures (e.g. a dict) into a Python file from a separate file
How to import or include data structures (e.g. a dict) into a Python file from a separate file I know I can include Python code from a common file using `import MyModuleName` - but how do I go about i...