Tagged Questions
Python is a dynamic and strongly typed programming language that is designed to emphasize usability. Two similar but incompatible versions of Python are in widespread use (2 and 3). Please consider mentioning the version and implementation that you are using when asking a question about Python.
0
votes
0answers
9 views
Python 2.7 failed to import csv module
I am on Python 2.7, OS X 10.10
from glob import glob
import csv
for i in glob("*.csv"):
with open(i) as csvFile:
next(csvFile);
originalData = csv.DictReader(csvFile, ...
0
votes
0answers
6 views
Ndb default order does not preserve insertion order
I used GAE and NDB for a project. I just noticed that if I create several objects, and then I retrieve the list of these objects the order is not preserved (i use the fetch() on the object).
This is ...
0
votes
0answers
4 views
Seaborn showing scientific notation in heatmap for 3-digit numbers
I'm creating a heatmap from a pandas pivot_table as below:
table2 = pd.pivot_table(df,values='control',columns='Year',index='Region',aggfunc=np.sum)
sns.heatmap(table2,annot=True,cmap='Blues')
It ...
0
votes
0answers
3 views
Defining inputs and fitness in ANN with GA Python
I am attempting to create a program that can find the best solution for winning a game using NN and I was hoping to get some help from the wonderful community here.
The game is a strategy war game, ...
0
votes
0answers
11 views
Custom gallery and add images to gallery
I want to make a simple gallery in django 1.8.
Want to have a gallery, to which I will add in the admin panel a few pictures images, descriptions and status, and save it. I want to have the ability to ...
0
votes
0answers
8 views
How to use mako templates in Generic Views django
I have implemented django-bootstrap-crud-templates(BSCT https://github.com/Alem/django-bootstrap-crud-templates ) app in one project.
There is another app called "demoapp" in the same project. ...
0
votes
0answers
9 views
Django admin inline: select_related
Using Django 1.8 on Python 3.4.1 with models:
class Product(models.Model):
name = models.CharField(max_length=255)
# some more fields here
def __str__(self):
return self.name
...
1
vote
0answers
10 views
Sparse matrix dot product keeping only N-max values per result row
I've got a very huge csr sparse matrix M. I want to get dot product of this matrix to itself (M.dot(M.T)) and keep only N max values per each row in the result matrix R. The problem is that dot ...
2
votes
1answer
25 views
Python Web Crawler not printing any result
I am trying to create a simple Web Crawler in Python, and when I'm running it it's showing no errors but it's also not printing any results as intended.
I've put my current code below, could anyone ...
0
votes
1answer
4 views
Django sqlite column not found error
I'm having a little trouble querying my sqlite DB. Has anyone seen this before? It may very well be that I am doing something silly
Here we have the schema:
BEGIN;
CREATE TABLE "homepage_user" (
...
1
vote
0answers
3 views
Setting flier (outlier) style in Seaborn boxplot is ignored
Using Seaborn, I can create boxplots of multiple columns of one pandas DataFrame on the same figure. I would like to apply a custom style to the fliers (outliers), e.g. setting the marker symbol, ...
0
votes
0answers
8 views
SQLAlchemy - Can't update table using NULL for primary key value
I have a query which should create a License instance and part of it looks like it:
license_obj = license_db.License()
license_db.Session.add(license_obj)
license_obj.start_date = ...
0
votes
0answers
8 views
WordNet: Iterate over synsets
For a project I would like to measure the amount of ‘human centered’ words within a text. I plan on doing this using WordNet. I have never used it and I am not quite sure how to approach this task. I ...
0
votes
0answers
4 views
Django Haystack Solar Changing templates and inherit a index
I have a module on which search is implemented (haystack, solar), now i am building another module, that does the same as previous module but this time the templates and URLs are change, So what I was ...
0
votes
0answers
10 views
Using SQLAlchemy sessions with flask & concurrency problems
I'm working on an API with Flask and SQLAlchemy, and here's what I would like to do :
I have a client application, working on multiple tablets, that have to send several requests to add content to ...
0
votes
0answers
14 views
How to use Decimal, without putting to much pressure on computing in Python.
I use linear regression gradient to calculate parametrs for my model, while using floats for linear model i had about 200 iterations per second which was ok. But since i use gaussian model i started ...
0
votes
2answers
10 views
stock.picking extension onchange for state not working
I have the following extension:
from openerp import models, api, fields
class MyExtension(models.Model):
_inherit = 'stock.picking'
some_instances = ...
0
votes
2answers
32 views
Changing running program behavior with shell commands
I'm writing a wallpaper manager in Python. I'm targeting this project for Linux and want to make the script easy to slip into autostart files (such as .xinitrc, et. al.). One functionality I'm hoping ...
1
vote
1answer
5 views
GTK - program doesn't follow intended order of functions
I'm quite new to this site, so I hope I follow all the rules whilst asking. On with the problem:
I'm making a GTK+ / Python3 program built with Glade. When the user clicks a button to Read a File, ...
0
votes
0answers
10 views
Cross Compiling Python for Embedded Linux - MIPS
Im trying to install the Cross Compiling Python for Embedded Linux for MIPS with documentation from this website - http://randomsplat.com/id5-cross-compiling-python-for-embedded-linux.html
On step ...
0
votes
0answers
9 views
Matplotlib: scrollbar for legend
Is it possible to have a scrollbar for legend in matplotlib, in cases where the legend list becomes very long?
For example, something like this:
0
votes
0answers
6 views
Lauch a subprocess on windows and monitor for dialogs/popups
is it possible to launch a process from python, monitor it and get a callback/notification/whatever if the process opens a dialog or popup?
Bonus points for the ability to click specific buttons on ...
0
votes
2answers
17 views
Passing a column name in a SELECT statement in Python
if count == 1:
cursor.execute("SELECT * FROM PacketManager WHERE ? = ?", filters[0], parameters[0])
all_rows = cursor.fetchall()
elif count == 2:
...
1
vote
0answers
13 views
bar plot is different from line plot
I am trying to plot two graphs on the same plot with a secondatu axis.
I am trying to plot the dataframe:
conversion_rate population
1 0.0002 1175000
2 0.0003 179000
3 0.0006 27000
4 ...
0
votes
1answer
10 views
What does it mean when I install Jinja2 that “the speedup extension could not be compiled, Jinja will fall back to the native python classes”?
I'm getting this message when I install it, and I'm not sure what the implications are. Can't find any information anywhere, and this is the first time I use Jinja, so not sure what to expect. Any ...
0
votes
0answers
14 views
“ImportError: No module named 'win32api'” when “import rpy2.robjects”
I get error
Traceback (most recent call last):
File "", line 1, in
import rpy2.robjects
File "C:\Python34\lib\site-packages\rpy2\robjects__init__.py", line 15, in
import ...
0
votes
0answers
18 views
Error python: No module named analytics service object when using google analitycs API
So, I am trying to get the number of sessions for each traffic source from google analitycs for a website, but I came across with this error:
Traceback (most recent call last): File
...
0
votes
0answers
24 views
How to efficiently calculate distances of n points in Python
I am new to Python and am currently writing a python postprocessing tool for my simulation of active spheres.
The main function is:
counter = 0
for data in itertools.islice(data_iter, ...
0
votes
0answers
10 views
Python - Fast ploting using pyqtgraph (16ms)?
I need to plot an continuous input using pyqtgraph, so I use a circular buffer to hold the data. I use deque with maxlen to do the job. (Python 2.7, numpy 1.9.2, pyqtgraph 0.9.10)
from collections ...
1
vote
0answers
18 views
Dynamically import packages with multiple files in Python
I am trying to dynamically import modules in python.
I need something like a plugin import system.
I use the following code for import of a module, and it works fine, as long as the entire code of ...
0
votes
1answer
12 views
Installing text codecs using pip
I wrote my own text codec and I want to be able to use it like any other codec:
"some string".encode("my-codec-name")
I can achieve this by putting my codec file in the C:\python27\Lib\encodings ...
0
votes
0answers
10 views
SymPy express variable in terms of another
I am using SymPy lib for Python.
I have two sympy symbols and expression that binds them:
x = Symbol('x')
y = Symbol('y')
expr = 2 * x - 7 * y
How can i express 'y' in terms of 'x', i.e get the ...
0
votes
0answers
7 views
Python 2.7.6 Pydoop installation fail on Ubuntu
I am facing this error while installing pydoop package:
root@ubuntu:~# pip install pydoop
Downloading/unpacking pydoop
Downloading pydoop-1.0.0.tar.gz (931kB): 931kB downloaded
Running setup.py ...
0
votes
0answers
12 views
How to get message sender host in zerorpc?
I want to use zerorpc to implement Publisher/Subscriber.
N clients send messages to 1 Server, this Server calls N Subscriber as a Publisher.
Just like N client --> server(publiser) --> N subscriber. ...
0
votes
0answers
3 views
Multi module custom Base Dir
I'm running sonar-runner on a python multi-module project.
The thing is my coverage.xml was created using <module>/build directory as a base.
But when importing it into Sonar, it uses ...
0
votes
1answer
12 views
White/blank screen when loading OpenERP
I am trying to open OpenERP using url http:// ip:port/ but it shows blank/white screen instead of login form. Earlier in the morning it was working fine.
I don't remember any particular changes that i ...
-2
votes
0answers
19 views
Django 1.7+: Clear cache for related views after saving a model instance
I can't find any solution for a basic problem with Django 1.7 that doesn't even exist in major CMSs I've used before: not expiring related cache after administrator edits something. And it's really ...
3
votes
4answers
60 views
Python zip by key
I'd like to combine (zip?) two python lists of tuples, but matching on a key.
e.g. I'd like to create a function that takes two input lists and produces an output like this:
lst1 = [(0, 1.1), (1, ...
0
votes
0answers
13 views
Videobackground and Button - Mobile
I have built This App. It is build on Flask. There is no mobilesupport right now.
Because the videoload is rather high, I want to serve the same videos but with a different resolution, cut and ...
0
votes
0answers
5 views
How to mark JIRA attachments by using JIRA Python API
I want to mark attachments that have already been downloaded to differentiate them with the one attached later on. Is it possible to set something like metadata of the attached files? Or any other ...
-1
votes
0answers
19 views
How do i make a large fantasy MMORPG size Height map pyopengl and pygame?
So I'm trying to make a sort of Shaiya/WoW type game (3D fantasy MMORPG) in python 2.7, pygame and pyopengl, but how am I suppose to make the maps using height maps. I would like them to be pretty big ...
0
votes
1answer
15 views
Webcam + Open CV Python | Black screen
I am using the code below, but I get a black image. Could you please help me rectify the error?
import cv2
import numpy as np
c = cv2.VideoCapture(0)
while(1):
_,f = c.read()
...
3
votes
1answer
25 views
What is the linux equivalent of sys.getwindowsversion()
There is no sys.getlinuxversion(), and I get the feeling I may have to pull into from a few places (which is fine); but, maybe not?
import sys
from collections import namedtuple
## This defines an ...
0
votes
0answers
7 views
How to get debugging information when running python script over Telit GL868?
I have a Telit GL868-DUAL GSM Module which support only RS232 connection. I am using python (pythonWin) to develop a program which will turn on LED for 3 seconds and then turn it off. I am using ...
0
votes
1answer
10 views
remove name, dtype from pandas output
I have output file like this from a pandas function.
Series([], name: column, dtype: object)
311 race
317 gender
Name: column, dtype: object
I'm trying to get an output with just the ...
0
votes
1answer
12 views
Tornado framework. TypeError: 'Future' object is not callable
I've started to learn Tornado framework sometime ago. I've faced the lack of documentation for unexperienced users and checked also asyncio module docs.
So the problem is, that I have some simple code ...
0
votes
3answers
65 views
Creating a list of lists using append function
I have two functions I have created as follows
def load_dates(stations):
f = open(stations[0] + '.txt', 'r')
dates = []
for line in f:
dates.append(line.split()[0])
...
0
votes
1answer
14 views
Hardcoding values into ndb model
I am working in webapp2 framework using python, I have a parent class(Examplestart) which has three properties:
variable = ndb.KeyProperty(kind=DBUser)
time = ndb.DateTimeProperty(auto_now_add=True)
...
0
votes
1answer
14 views
Hard time catching Environment Exception in Python
I have this simple code to setup a logfile at specific location:
(Python 2.7.3)
import os, errno
try:
CCustomLogger.setup_daemon_logger('TRexServer', "/var/log/trex/trex_daemon_server.log")
...
-1
votes
1answer
15 views
Python: set axis scale in canvas
In Python, using the canvas module, how do I make a canvas in which the x-axis starts at 0?
I can make a script which draws the gridlines at 0, but the actual canvas still goes from -10 to 10
I'm ...