Top "Python-import" questions

For questions about importing modules in Python

Cython: cimport and import numpy as (both) np

In the tutorial of the Cython documentation, there are cimport and import statements of numpy module: import numpy as np …

python numpy cython python-import
How to reference an exception class in Python?

I want to catch a GPSException thrown by the gpxpy library. try: gpx = gpxpy.parse(open(filepath)) except GPXException: print "…

python exception namespaces python-import gpx
Python's __loader__, what is it?

I've seen the term __loader__ floating around some Python files and I can't find any documentation on it aside from …

python loader python-import
Recursive version of 'reload'

When I'm developing Python code, I usually test it in an ad-hoc way in the interpreter. I'll import some_module, …

python python-module python-import
Why does import error change to "cannot import name" on the second import?

Here's a mysterious python problem: I'm developing a python package that occasionally reports import errors looking like ImportError: cannot import …

python importerror python-import
Pycharm auto relative imports

Whenever you use autoimport provided by PyCharm it generates an absolute path import. i.e. from my_package.my_subpackage …

python pycharm python-import relative-import
Python 3.7 import gpiozero ModuleNotFoundError No module named 'gpiozero' on raspberry pi zero

Built Python 3.7 on my Raspberry pi zero in a attempt to upgrade from Python 3.5.3 The build was successful, ran into …

python python-3.x raspberry-pi python-import gpiozero
How to import the own model into myproject/alembic/env.py?

I want to use alembic revision --autogenerate with my own model classes. Because of that I need to import them …

python-3.x python-import alembic
How to prevent a race condition when multiple processes attempt to write to and then read from a file at the same time

I have the following code (simplified for clarity): import os import errno import imp lib_dir = os.path.expanduser('~/.…

python io race-condition python-import python-os
python, Stemmer not found

I got this code from github and this code will execute on windows machine 64 bit. Here's the error I get: …

python-3.x python-import stemming