1 answer

pyhton threading module: Is overriding run() neccessary

I am reading tutorials to understand multithreading, and everywhere I see people overriding the run method. It is not clear to me from the doc This class represents an activity that is run in a ...

1 answer

access multiple values against 1 duplicating key

I have 2 columns. RAB10 -0.016575 MEF2C -0.019655 SP2 1.24E-01 SP2 -0.18870625 SP2 0.0879425 I want output like RAB10 -0.016575 MEF2C -0.019655 SP2 1.24E-01 -0.18870625 ...

1 answers | 1 min ago by Seher newbee on Stack Overflow stackoverflow.com
0 answers

Pandas getting average of selected column

I am sure that this is quick one, but I can't figure it out. here's first 15 elements of my dataframe: What I need is average(column(Total Rainfall) per year(column (Year). Dataset I have contains ...

1 answer

Fastest way of calculating mean values for each indices

I have two 2d arrays of equal shapes: given_array and reference_array. I have to write a file for each unique value of the reference_array computing mean values where the unique value are in the given ...

1 answer

How to break xlib's next_event()?

I am using QThread (pyside) for handling global hot-keys on X11. I have some simple while loop which looks like: while self.doRun: event=root.display.next_event() if ...

3 answers

Python TypeError: coercing to Unicode: need string or buffer, file found

I am into learning Python, with a C- language background. Sorry, if my problem is 'naive' or 'too simple' or 'didn't worked enough'. In the below code, I want to practice for future problems, the ...

3 answers | 10 mins ago by jiten on Stack Overflow stackoverflow.com
0 answers

Python Tkinter Tk root_after Delay

I'm trying to do a chess clock using tkinter, and to do so i'm using the root.after method from the class Tk of tkinter. When the program starts, it runs really well, but after a while the clock start ...

1 answer

pygame.midi Exception: PortMidi: `Insufficient memory'

Im trying to setup pygame.midi to communicate with my midi input device (usb) but i keep getting " Exception: PortMidi: `Insufficient memory' " and if i retry without reinitializing i get" ...

1 answers | 17 mins ago by katte on Stack Overflow stackoverflow.com
1 answer

Connect to a MongoDB at other computer

I need your help. I'm working on a project with Raspberry PI and I need to connect my Raspberry PI's python program to a MongoDB server, which is running on my computer with Ubuntu. How can I connect ...

2 answers

python script “import hashmap” printing '0's and '-1's

When run a python script that just has one line of code import hashmap , it prints out just like this 0 -1 0 -1 and more 0s and -1s It's wired and I cannot figure out the reason. Here is the ...

2 answers | 22 mins ago by user2916610 on Stack Overflow stackoverflow.com
2 answers

Descover IPC interface for undocumented program?

I have a program without documentation. I am wondering if there is a way to discover if it has any interface for interprocess communication. Are there any tools that search through an executable to ...

2 answers | 23 mins ago by Harvey on Stack Overflow stackoverflow.com
2 answers

Python ConfigParser interpolation from foreign section

With Python ConfigParser, is it possible to use interpolation across foreign sections? My mind seems to tell me I've seen that it's possible somewhere, but I can't find it when searching. This ...

2 answers

Getting intersection of two lists in python

I have two lists of genes that i'm analyzing. Essentially I want to sort the elements of these lists much in the same way as a Venn diagram, i.e. elements that only occur in list 1 are placed in one ...

1 answer

unable to start instance using python in aws using boto

import boto.ec2 conn = boto.ec2.connect_to_region("us-west-2", ... aws_access_key_id='<aws access key>', ... aws_secret_access_key='<aws secret key>') Did this substituting values ...

1 answer

json.loads return string instead of int ? python

I have this json string :{"bussID":"5625"} json1=json.loads('{"bussID":"5625"}') value=json1['bussID'] if not isinstance(value, (int, long)): print("string") I don't understand why the value is ...

1 answers | 47 mins ago by david on Stack Overflow stackoverflow.com
0 answers

Access method for sqlite

For 'A' Level Computing I'm writing code in Python and using sqlite to store the data. In my design write up I have to specify the mode of access to my data files (serial, sequential, indexed ...

0 answers

Cython error: declaration does not declare anything

I'm writing some cython code, and I've come across an odd problem. When I try to pass an object straight from python to C as a struct, cython generates the code fine, but gcc doesn't like the code ...

0 answers

AttributeError: Encryption instance has no attribute '__getitem__'

I am tring to create a AES like crytography code and I am having errors that I need help with. File "C:\Users\work\Desktop\try.py", line 156, in byte_construct if (pos & ...

2 answers

How to count the numbers in values in a dictionary

I'm trying to count the amount of values that contain numbers that show up in the values of dictionary entries, and then put them in a list. So for example: some_dictionary = {'FIRST' : ['a', '1', ...

4 answers

Sending StopIteration to for loop from outside of the iterator

There are several ways to break out of a few nested loops They are: 1) to use break-continue for x in xrange(10): for y in xrange(10): print x*y if x*y > 50: ...

1 answer

Django Gunicorn workers won't boot

I have a Django app I am trying to set up on an Ubunutu VPS with Gunicorn and I'm encountering an error when running gunicorn project:application -b myip:8000 . Here is the output that results: ...

7 answers

OpenCV 2.4 VideoCapture not working on Windows

I'm using Python bindings to OpenCV 2.4 installed with following instructions. My problem is similar to this one, but I need Windows machine solution. Problem: when I try to use cap = ...

7 answers | 1 hour ago by Bihaqo on Stack Overflow stackoverflow.com
1 answer

What is a proper way to implement a state engine with asynchronous events?

I am developing a travel itinerary booking engine. The use case is like this: customers make a reservation for a journey that involves multiple legs (a leg is a contiguous part of the journey, ...

2 answers

Asynchronous call from QML to Python with callback

From QML, I'd like to: Call a Python slot. Pass along a callback. Have that callback be run once the slot is complete. I've tried this: Register a context-property (Service) Call ...

3 answers

Is this function recursive even though it doesn't call itself?

from pythonds.basic.stack import Stack rStack = Stack() def toStr(n,base): convertString = "0123456789ABCDEF" while n > 0: if n < base: ...

3 answers | 1 hour ago by kalin on Stack Overflow stackoverflow.com
1 answer

Generate list of all combinations and maintain index position

I'm looking for a method to generate a list of all combinations with its current index kept maintained: So far i've been using this method: stuff = ['A', 'B', 'C'] for L in range(0, len(stuff)+1): ...

0 answers

Why can't access variables? 500 Interal Server Error

I have a list that is passed to an ajax function. First grab all the quantities from each input into a list, then I proceed to feed the list into a function which should return and update the total ...

0 answers

Embedding python 3.4 into C++ Qt Application?

I'm making an Qt Quick GUI application(for windows), which uses OpenGL and C++ for some computationally intensive stuff. I want to embed python code into the app, for doing some stuff which is ...

4 answers

Work with tuples as dictionary keys

I use GraphViz library and in some case, it retuns me a dictionary having tuple as keys. {(4, 7): 0, (2, 6): 1, (10, 4): 1, (5, 11): 1, (4, 5): 1, (2, 8): 0, (8, 11): 0, (10, 0): 1, (6, 11): 1, (9, ...

3 answers

Python regex: replace ignoring empty string

I am trying to replace a given pattern with regular expressions in Python, using re. Here is the piece of Python code I wrote: import re fname = './prec.f90' f = open(fname) lines = f.readlines() ...

3 answers | 1 hour ago by MBR on Stack Overflow stackoverflow.com
15 30 50 per page
1 2 3