Tagged Questions
0
votes
1answer
21 views
Install Locally Developed Python Module
I am currently in the process of developing a module that I am using as a library to be imported in another project. I need a sane way that I can install this module in the python site packages in ...
0
votes
1answer
63 views
Is it ok to extend Python module like this?
I have a base Python module basemodule.py with many functions and classes. Now I want to create many new modules, new1.py, new2.py, new3.py, etc.
Each of these modules will only add or change 1-2 ...
0
votes
1answer
55 views
How do I dynamically reload a module in a custom package?
I am trying to reload an entire custom package of modules that I wrote.
There is another question that I looked into on here, but it does not look like it works in my case.
modules/__init__.py
# ...
2
votes
3answers
48 views
Why does simply importing a python module executes everything present in that module ? [duplicate]
Recently I noticed that using modules was a good option to keep my python programming tidy.
For getting started, I made one module (named, oop.py) with a single class in it, which looks like below:
...
7
votes
1answer
101 views
How to install NodeBox for console
I'm working on OS X Mavericks and want to use the NodeBox modules in Python scripts.
The post about how to install the modules for console is from 2009 and doesn't work anymore as this refers to ...
2
votes
1answer
69 views
Python internals - How do objects know about global variables?
I recently discovered some interesting behavior that left me wondering about how an object knows about which global variables exist. For example, suppose I have a file "test.py":
globalVar = 1
...
0
votes
1answer
32 views
How to make pefile python module read multiple executable file in a directory
I'm currently working on this python code using pefile python module
import pefile
pe = pefile.PE('C:\Documents and Settings\Zha\Desktop\\test\\firefox.exe')
pe.parse_data_directories()
print ...
1
vote
0answers
59 views
Using a local module instead of system installed module (Python 2.x.x)
I have a cluster system at work with Python and some modules installed on that system - however I wanted to use the most up to date version of the module - it has several methods not present in older ...
0
votes
1answer
36 views
Cannot import livestreamer module in python
I am new to python and just tried to import the live streamer module (http://livestreamer.readthedocs.org/en/latest/api.html) in Python.
The module is installed at:
...
0
votes
2answers
88 views
what library is able to extract SIFT features in Python?
In python which library is able to extract SIFT visual descriptors? I know opencv has an implementation but it is not free to use and skimage does not include SIFT particularly.
1
vote
0answers
41 views
ImportError: no module named pyslow.tool - how to 'use' pyslow 'correctly'?
Using Pyslow found at https://launchpad.net/pyslow, I've taken all the steps in the README. When I run the program, the message I get is
File "/usr/local/bin/pyslow", line 9, in <module>
...
0
votes
0answers
59 views
How to install python packages in Ubuntu SS? (noob)
I don't normally use python or act as a server admin in the least. I need to install the xlrd package. I have downloaded the package but have no idea where to upload this package on the server. I see ...
5
votes
4answers
140 views
Two instances of the same Python module?
I created a Python module with a single function that just prints 'a!'. I opened up the Python interpreter and imported the module in 2 different syntaxes
>>> import a
>>> from a ...
2
votes
3answers
1k views
Playing remote audio files in Python? [closed]
I'm looking for a solution to easily play remote .mp3 files. I have looked at "pyglet" module which works on local files, but it seems it can't handle remote files. I could temporary download the .mp3 ...
0
votes
3answers
133 views
Python module: how to prevent importing modules called by the new module
I am new in Python and I am creating a module to re-use some code.
My module (impy.py) looks like this (it has one function so far)...
import numpy as np
def read_image(fname):
....
and it is ...
1
vote
0answers
30 views
Changes doesn't apply to a python module
I am relatively new to python. I've started using and completing an under-development python library. However, the changes that I make in the modules don't apply. That is, I debug the code and the ...
1
vote
1answer
59 views
How to dynamically load a module in python
I'm trying to dynamically load modules. I've seen many questions on this topic - but none helped.
I've got this directory structure:
root
|-- tests
|---- test_modules
|------ modules (files=test.py, ...
4
votes
1answer
288 views
Installation error of python package using pip
I tried to install a python module called python-phonenumbers
I got this error
sudo pip install git+git://github.com/daviddrysdale/python-phonenumbers.git
Cleaning up... Command /usr/bin/python ...
0
votes
0answers
44 views
List installed Python modules error [duplicate]
When attempting to list all installed Python modules, as described here, I received the following output and caused python2.7 to "close unexpectedly."
Any ideas?
user@user-VirtualBox:~$ python
...
7
votes
5answers
1k views
Installing nose using pip, but bash doesn't recognize command on mac
I'm trying to install nose on my computer for the Learn Python the Hard Way tutorial, but can't seem to get it to work. I'm using pip to install:
$ pip install nose
And I get back:
Requirement ...
0
votes
0answers
201 views
pkg_resources.DistributionNotFound when zipping 3rd party modules
I'm trying to add third party modules to a 2.7.2 Python installation.
To optimize that installation in terms of memory, I'm zipping the whole /lib/python2.7/ directory into /lib/python27.zip (except ...
0
votes
1answer
56 views
Can not import class from custom django package
I am writing a custom Django module but I seem to have something wrong. I cannot import a class that lives in a certain file. I get the error
ValueError: Unable to configure handler 'admins': Cannot ...
1
vote
1answer
61 views
How does python know that you need to interface the requests module through api.py?
In my foray into learning more about Python, I've been studying the structure of a Python module called requests or sometimes known as python-requests.
Now, the question is this, which is a link to ...
3
votes
0answers
173 views
Keeping Python packages with the same top-level name in different directories
I have several Python packages that I'd like to keep on separate filesystems but which unfortunately share the same top-level module name.
To illustrate, the directory structure looks like this:
...
0
votes
1answer
1k views
Python — class vs module
I'm working on a group of functions that are probably easier to manage on their own, just in a module. But there are reasons beyond my pay-grade that would like to think about turning this into a ...
-3
votes
1answer
54 views
Call functions from class which is in another Python-File
I have the following Problem in Python 2.7:
If I define 3 functions in a file "a.py",
and call these functions in another file, like:
import a
a.function1(arg1,...)
everything works fine.
But when ...
0
votes
2answers
65 views
In Python, is it a bad idea for a directory module's __init__.py to do this?
I have a package with several subdirectories containing __init__.py files. These files perform checks and initialization jobs.
Now I also have in some of these folders a file that isn't supposed to ...
1
vote
1answer
162 views
Django AttributeError in settings.py file
I've been stuck all day on what seems to be a very silly import problem. From my Django project directory, I can import a module and run a function just fime:
(msg-gw)slashingweapon:~/msg-gw/www$ ...
0
votes
1answer
91 views
release code in Pypi
I want set my package to Pypi.
When I run
python setup.py sdist bdist_wininst upload
occur this error:
File "setup.py", line 8, in <module>
long_description=open('README.txt').read(),
...
33
votes
1answer
30k views
How to write a Python module?
I've been making Python scripts for simple tasks at work and never really bothered packaging them for others to use. Now I have been assigned to make a Python wrapper for a REST API. I have absolutely ...
3
votes
2answers
16k views
Python: OSError: [Errno 2] No such file or directory: ''
I have a 100 lines, 3 years old python scraper that now bug. Starting lines are:
import urllib, re, os, sys, time # line 1: import modules
os.chdir(os.path.dirname(sys.argv[0])) # line 2: all ...
3
votes
1answer
4k views
PyInstaller cannot find libpython2.7.so when making binary?
I'm trying to make a binary version of a Python script using PyInstaller 2.0 on Linux. When I run:
$ python pyinstaller.py myscript.py
I get the error:
8907 INFO: Looking for Python library ...
6
votes
1answer
454 views
How to override stuff in a package at runtime?
[EDIT: I'm running Python 2.7.3]
I'm a network engineer by trade, and I've been hacking on ncclient (the version on the website is old, and this was the version I've been working off of) to make it ...
3
votes
2answers
194 views
Automatically import to all Python files in the given folder?
I am relatively quite new to Python and I try to learn the "Pythonic" way of doing things to build a solid foundation in terms of Python development. Perhaps what I want to achieve is not Python at ...
0
votes
2answers
311 views
problems installing matplotlib for Python — or, how else to graph in Python?
I currently have Python2.7, and Python3.3 installed on a Mac. I am trying to install matplotlib so that I can create candlestick, and line graphs. I have tried multiple methods of installing ...
0
votes
0answers
351 views
why i cannot import sqlite3 module?
my question is similar to ImportError: No module named _sqlite3 no solution yet,
No module named _sqlite3 i build python from source, so my solution should not by install some package to solve my ...
0
votes
1answer
131 views
How to prevent an imported module from 'importing' sys.argv[1:]
I am a python newbie. To pose my question in a comprehensible manner, I created two scripts. One script is named: called_script.py The other script is named: calling_script.py
The following two ...
37
votes
5answers
5k views
Python: What's the difference between __builtin__ and __builtins__?
I was coding today and noticed something. If I open a new interpreter session (IDLE) and check what's defined with the dir function I get this:
$ python
>>> dir()
['__builtins__', '__doc__', ...
0
votes
1answer
1k views
Changing python global variables between modules
I'm trying to carry a change from a global variable over to another module in Python2.7.
I've done this in similar situations before but for some reason it won't work in this instance.
The first file ...
2
votes
2answers
877 views
Python robotparser module won't load 'robots.txt'
I'm writing a very simple web crawler and trying to parse 'robots.txt' files. I found the robotparser module in the standard library, which should do exactly this. I'm using Python 2.7.2. ...
1
vote
2answers
281 views
Python dependency between modules [duplicate]
Possible Duplicate:
Python: Circular (or cyclic) imports
Circular dependency in Python
I have a Python package featuring two modules that import each other. That is, in module A we have ...
-1
votes
3answers
97 views
what is wrong with this python code? the if block is not getting executed
I am writing a module, in which the email string is validated before it gets inserted into the db. When i try to enter invalid email string it prints else block with wrong email message but when i ...
2
votes
3answers
107 views
Weird stuff happening while importing modules
I hate to give the question this heading but I actually don't know whats happening so here it goes.
I was doing another project in which I wanted to use logging module. The code is distributed among ...