Linked Questions

590 votes
14 answers
381k views

Currently I am working on a python project that contains sub modules and uses numpy/scipy. Ipython is used as interactive console. Unfortunately I am not very happy with workflow that I am using right ...
Alain's user avatar
  • 6,005
340 votes
13 answers
205k views

I need a working approach of getting all classes that are inherited from a base class in Python.
Roman Prykhodchenko's user avatar
183 votes
7 answers
648k views

I'm trying to access a serial port with Python 2.6 on my Raspberry Pi running Debian. My script named serial.py tries to import pySerial: import serial ser = serial.Serial('/dev/ttyAMA0', 9600) ser....
hao_maike's user avatar
  • 3,079
127 votes
10 answers
175k views

I am writing a script that will try encoding bytes into many different encodings in Python 2.6. Is there some way to get a list of available encodings that I can iterate over? The reason I'm trying ...
Amandasaurus's user avatar
  • 61.3k
89 votes
5 answers
61k views

I had never noticed the __path__ attribute that gets defined on some of my packages before today. According to the documentation: Packages support one more special attribute, __path__. This is ...
Jason Baker's user avatar
41 votes
5 answers
48k views

How to get the name/list of all submodules of an already imported Python module? (Not the external imported module/packages, just that one in the same folder as module sub-folder). I am using import ...
hildogjr's user avatar
  • 896
16 votes
3 answers
23k views

I have looked around and do not see a solution for this. What I would like to do is get a list of all packages available in Python at run-time. I looked at these: List all the modules that are part ...
Tom Myddeltyn's user avatar
8 votes
2 answers
7k views

Expected behavior and actual behavior. I expected to compile a script using rasterio into an executable using pyinstaller. The script runs fine from within my python environment. However I am not ...
user32882's user avatar
  • 6,107
8 votes
1 answer
3k views

I am using scipy and numpy through Anaconda 2.1.0 distribution. I use Spyder as my Python IDE. When I run import scipy as sp, I can't access the subpackages, such as optimize, linalg, cluster etc. ...
user3317287's user avatar
0 votes
1 answer
6k views

I am migrating an app I have written to the standard Python package format. As I have my app's modules divided over several directories, I used to import these by inserting their respective paths to ...
Stephan Heijl's user avatar
2 votes
1 answer
1k views

I am trying to follow this post, to list all the modules in the NX Open package: import NXOpen import pkgutil the_string = "" package = NXOpen for importer, modname, ispkg in pkgutil....
Foad S. Farimani's user avatar
0 votes
1 answer
2k views

I am trying to import modules in Python dynamically. That means - I have a Python package with modules inside. Without specifying the modules names, I want to keep a dictionary of each module's name ...
Tamar's user avatar
  • 175
3 votes
1 answer
734 views

Given a Python package, how can I automatically find all its sub-packages? I used to have a function that would just browse the file system, looking for folders that have an __init__.py* file in them,...
Ram Rachum's user avatar
  • 89.5k
2 votes
2 answers
253 views

I have this structure: project/ sources/ __init__.py source_one.py source_teo.py main.py Then in main.py import sources # Here I'd like to get a list with [source_one,...
Gocht's user avatar
  • 10.3k
2 votes
2 answers
322 views

I want to check if a passed function is a Numpy function or not. for example: import numpy as np def my_func(passed_func): if passed_func is Numpy function: # Here is the problem print('...
A.Najafi's user avatar
  • 699

15 30 50 per page