Tagged Questions
0
votes
1answer
16 views
How can I connect to bluetooth 4.0 / Bluetooth LE devices from a Mac?
Is it possible to configure a bluetooth LE device as Serial port and use PySerial? Bluetooth 4 devices don't show up under bluetooth system preferences.
In terms of python modules, pybluez can't be ...
1
vote
0answers
25 views
Use jinja2 without install
Is it possible to use Jinja2 without installing it using easy_install or pip ? I dont have root access on my server but I would like to use Jinja2. I was wondering if I could do this:
import ...
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 ...
1
vote
1answer
21 views
Can't access full python module from file, but can from shell
Maybe I am completely missing something here but when I run this code form the shell it works:
import nltk
tokens = nltk.word_tokenize("foo bar")
and returns:
['foo','bar']
But when I but this ...
1
vote
2answers
32 views
Install python module for non-default version on linux
I have different python versions installed on my ubuntu machine. The default version is 2.7.
So when I install any new python module, for example using:
#apt-get install python-nfqueue
it will be ...
0
votes
3answers
935 views
Dot-slash not recognized in command prompt - Trying to install Python module
I am trying to install a Python module in command prompt. The directions state to run "./configure" to install the module and then run a make command. However, whenever I do that, I receive the ...
0
votes
1answer
35 views
Can regular python modules like random and time be used with kivy to make android apps?
If not could you tell me the kivy equivalent to time.sleep please?
0
votes
1answer
62 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 ...
-4
votes
1answer
25 views
How to install Py-Moneyed? [closed]
I'm trying to add MoneyField to my Django App using Django-Money.
According to the requirements, I need to install py-moneyed v0.4 or later.
I checked py-moneyed but it doesn't mention how to ...
8
votes
5answers
2k views
What exactly is a “raw string regex” and how can you use it?
From the python documentation on regex, regarding the '\' character:
The solution is to use Python’s raw string notation for regular
expression patterns; backslashes are not handled in any ...
1
vote
3answers
1k views
Python libraries to calculate human readable filesize from bytes?
I find hurry.filesize very useful but it doesn't give output in decimal?
For example:
print size(4026, system=alternative) gives 3 KB.
But later when I add all the values I don't get the exact ...
7
votes
4answers
2k views
Installing python module within code
I need to install a package from PyPi straight within my script.
Maybe there's exists module or distutils (distribute, pip) ability which allows me just execute something like pypi.install('requests') ...
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
# ...
0
votes
1answer
31 views
Simple Python POST urlencode()
I'm trying to send a POST to my Node.js app using Python. Here is my code
import urllib
import urllib2
url = my_url
values = {'email' : my_email,
'password' : my_password }
data = ...
79
votes
3answers
88k views
How do I find out my python path using python?
How do I find out which directories are listed in my system’s PYTHONPATH variable, from within a Python script (or the interactive shell)?
1
vote
3answers
19 views
Directory setup for python modules
I'm looking to create a python module with the following imports. However, I'm not sure how to go about structuring the files / directories to get the desired effect?
import one
from one import two
...
0
votes
0answers
45 views
Trying to install python module entropy in windows
i'm trying to install the python module entropy in windows since monday, but nothing will work.
OS: Windows x64
Python Version: Python 3.4.1 (...) [MSC v.1600 64 bit (AMD64)] on win32
I read already ...
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:
...
0
votes
0answers
27 views
Python module 'lxml' won't look for its dependencies in the proper directory during installation
I have been trying to install a python module called lxml to my account on a university supercomputer running RHEL.
I do NOT have root or super user privileges.
lxml requires the devel versions of ...
7
votes
1answer
99 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 ...
0
votes
1answer
30 views
Navigate to Python module by name in Intellij keyboard shortcut
Using Control+N while coding JAVA in IntelliJ helps me to navigate to classes.
Is there any similar functionality in IntelliJ for navigating to Python modules.
Thanks
1
vote
1answer
41 views
Python module name clash
I have a module named after the product I'm working on, and some 3rd party built a package for our product's API with the same module name. In attempting to use the latter, the module names collide. ...
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:
...
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 ...
1
vote
1answer
34 views
How to find import name/key of pip3 installed module
I am aware of how to install new python modules with pip. I have great success with that. But once the modules are installed, I have no idea how to import them.
For example, I may run
sudo pip3 ...
0
votes
2answers
482 views
cannot import Python-Twitter
I recently started out with python and i'm right now looking to do an app that shows my Twitter feed. So I downloaded a module(not sure if its called that) called Python-Twitter and installed it. But ...
18
votes
8answers
21k views
What do I need to read Microsoft Access databases using Python?
How can I access Microsoft Access databases in Python? With SQL?
I'd prefere a solution that works with Linux, but I could also settle for Windows.
I only require read access.
7
votes
2answers
3k views
Easiest way to automatically download required modules in Python?
I would like to release a python module I wrote which depends on several packages. What's the easiest way to make it so these packages are programmatically downloaded just in case they are not ...
0
votes
2answers
45 views
import a module with parameter in python
Is it possible to pass import a module with some parameter in python ?
All I mean by parameter is that there exists a variable in the module which is not initialized in that module, still I am using ...
2
votes
1answer
68 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
...
3
votes
2answers
1k views
ImportError: No module named backend_tkagg
I have such imports and code:
import pandas as pd
import numpy as np
import statsmodels.formula.api as sm
import matplotlib.pyplot as plt
#Read the data from pydatasets repo using Pandas
url = ...
1
vote
0answers
1k views
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 35: ordinal not in range(128)
I'm trying to install pyopenssl v 0.13.1 on my kali linux distro.
when I do:
sudo pip install pyopenssl==0.13.1
Downloading/unpacking pyopenssl==0.13.1
Downloading pyOpenSSL-0.13.1.tar.gz ...
0
votes
1answer
31 views
Python - Package binary, modules and script althogether
First things first, I am still in the process of learning Python (its best-practices and how things work regarding the whole distribution system), so I am NOT an expert.
I need to create a single ...
0
votes
1answer
55 views
Python Path not consistent in Django- double module imports
I am having an issue in my Django project where I am importing the same module twice. This is causing a unit test of mine to fail: this unit test checks that the view found by resolving a URL is the ...
12
votes
4answers
16k views
Import python module NOT on path
I have read all the questions I could find on it on SO, but none answers my question.
I have a module foo, containing util.py and bar.py.
I want to import it in IDLE or python session. How do I go ...
7
votes
2answers
2k views
Determining the location of distutils data files programmatically in Python
I'm trying to include data files in distutils for my package and then refer to them using relative paths (following http://docs.python.org/distutils/setupscript.html#distutils-additional-files)
My ...
-1
votes
1answer
78 views
How to pass variable from one python script to another
my code has this structure
class Mapsframe(wx.Frame):
def __init__(self):
import application
class Example(wx.Frame,listmix.ColumnSorterMixin):
def __init__(self, *args, **kwargs):
...
1
vote
0answers
58 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 ...
1
vote
1answer
24 views
Specify the developement version of a python module
I want to add a new class to PICOS, a python module. I installed it the normal way a long time ago. But now I have downloaded the source and I a am trying to make some changes.
The problem is that I ...
21
votes
2answers
13k views
Should I use `scipy.pi`, `numpy.pi`, or `math.pi`?
In a project using scipy and numpy, should I use scipy.pi, numpy.pi, or math.pi?
Ten minutes on google and Stack Overflow doesn't give an answer.
17
votes
6answers
17k views
How to properly use relative or absolute imports in Python modules?
Usage of relative imports in Python has one drawback, you will not be able to run the modules as standalones anymore because you will get an exception: ValueError: Attempted relative import in ...
211
votes
11answers
112k views
How to import a module given the full path?
How can I load a Python module given its full path? Note that the file can be anywhere in the filesystem, as it is a configuration option.
0
votes
1answer
45 views
Installing Unirest python module in Google App Engine
Hi i am new to GAE and python. I am trying to create small web application in GAE using python. I intend to use Unirest module in application.
I followed instruction in this post and got following ...
2
votes
2answers
1k views
Python: explain “heapq” module please
I tried "heapq" and arrived at the conclusion that my expectations differ from what I see on the screen. I need somebody to explain how it works and where it can be useful.
From this book under ...
0
votes
1answer
44 views
How to use .so modules from Python 2 in Python 3?
probably my question is obvious but I was not able to find an obvious decision.
There are Python 2.6+ extensions called audit and auparse. These are dynamical libraries distributed with ...
22
votes
4answers
7k views
How do I document a module in Python?
That's it. If you want to document a function or a class, you put a string just after the definition. For instance:
def foo():
"""This function does nothing."""
pass
But what about a ...
0
votes
2answers
54 views
how to run python script on a machine where I can't install the required package?
I want to run a python script on a remote linux machine.
The script requires a package networkx. However, I can't install python package on the remote machine, so what can I do?
3
votes
3answers
2k views
Virtualenvwrapper not found
Given what I know about Python, the problem I'm having shouldn't been happening. I installed virtualenvwrapper on Mac OS X Snow Leopard with pip. It's there in /Library/Python/2.6/site-packages. ...
0
votes
1answer
20 views
System Paths and Modules
I have the following setup:
/project/
/api/
__init__.py
test.py
/modules/
__init__.py
api.py
I am trying to, from the /project/ directory, run api.py: python ...
10
votes
5answers
4k views
Prevent Python from caching the imported modules
While developing a largeish project (split in several files and folders) in Python with IPython, I run into the trouble of cached imported modules.
The problem is that instructions import module only ...