I am testing my application and I am running into an issue and I'm not sure why. I'm loading fixtures for my tests and the fixtures have foreign keys that rely on each other. They must be loaded in a certain order or it won't work.
The fixtures I'm loading are:
["test_company_data", "test_rate_index", 'test_rate_description']
Company ...
So, for example I draw some objects on wx.PaintDC, such as lines and rectangles.
Now I want next: on mouse click I wont know which object was clicked.
Of course, I can see what object is the closest, but what about more exact answer?
Maybe even not standart wx.DC, but such things as FloatCanvas or something like this.
So, what's the be...
I'm working with XML and Python for the first time. The ultimate goal is to send a request to a REST service, receive a response in XML, and parse the values and send emails depending on what was returned. However, the REST service is not yet in place, so for now I'm experimenting with an XML file saved on my C drive.
I have a simple bi...
Hello Friends,
I am trying to connect to radian6 api, which requires the auth_appkey, auth_user and auth_pass as md5 encryption.
When I am trying to connect using telnet I can get the response xml successfully
telnet sandboxapi.radian6.com 80
Trying 142.166.170.31...
Connected to sandboxapi.radian6.com.
Escape character is '^]'.
GET...
I want to do something like this:
select username, userid, 'user' as new_column from users_table.
The columns of the table can be selected using sqlalchemy as follows:
query = select([users_table.c.username, users_table.c.userid])
How do I do the select x as col_x to the query in sqlalchemy?
...
I've never seen this error before, and none of the hits on Google seem to apply. I've got a very large NumPy array that holds Boolean values. When I try writing the array using numpy.dump(), I get the following error:
SystemError: NULL result without error in PyObject_Call
The array is initialized with all False values, and the only ti...
I would like to be able to abort a task that is running from a Celery queue (using rabbitMQ). I call the task using
task_id = AsyncBoot.apply_async(args=[name], name=name, connect_timeout=3)
where AsyncBoot is a defined task.
I can get the task ID (assuming that is the long string that apply_async returns) and store it in a database...
I am putting a bunch of related stuff into a class. The main purpose is to organize them into a namespace.
class Direction:
north = 0
east = 1
south = 2
west = 3
@staticmethod
def turn_right(d):
return turn_to_the_right
@staticmethod
def turn_left(d):
return turn_to_the_left
# defined a short alias because ...
I have a number of directories containing the files similar to the below example:
test
setup
adder
hello
_CONFIG
TEST2
The file(s) in these directories with the prefix _ represent configuration files of significance. The aim was to have these files appear first when I listed the directory i.e. I would like to be provided with:
_CONFI...
I'm trying to use mplot3d. I installed matibplot using the Ubuntu (lucid) repositories and it seems broken out-of-the-box. Any help would be appreciated.
This is the code I'm running:
from __future__ import division
from mpl_toolkits.mplot3d import Axes3D
from random import *
from scipy import *
import matplotlib.pyplot as plt
locA = ...
{x for x in range(10)}
works perfectly on IDLE, but when I try this in eclipse (with Pydev plugin) I get a syntax error:
Undefined variable: x
Is it because Pydev doesn't support set comprehensions or something? What can I do to make this work?
(This was just one example that doesn't work. All set comprehensions don't work for me...
I have a command line mini-app written in Python 2.7 that has a "press any key" style prompt, but that responds differently depending on what kind of key the user types.
If they type a character, then that character will become the first character of the search query. I don't want the user to have to type a character to indicate "I'm do...
I try to send POST data to a server using urlfetch in AppEngine. Some of these POST-data items has the same name, but with different values.
form_fields = {
"data": "foo",
"data": "bar"
}
form_data = urllib.urlencode(form_fields)
result = urlfetch.fetch(url="http://www.foo.com/", payload=form_data, method=urlfetch.POST, headers={...
I am wondering how would one get variables inputted in a python script while opening from cmd prompt? I know using c one would do something like:
int main( int argc, char **argv ) {
int input1 = argv[ 0 ]
int input2 = argv[ 1 ]
.....
}
how can I achieve the same kind of result in python?
...
How do I really disable gtk treeview interactive search? The docs say to set_enable_search(False), but if I do this, CTRL+F still causes an annoying search pop-up to appear. Connecting to start-interactive-search and returning True doesn't work either.
...
>>> a = os.popen('chcp 65001')
>>> a.read()
'Active code page: 65001\n'
>>> a.close()
>>> a = os.popen('chcp')
>>> a.read()
'Active code page: 437\n'
>>> a.close()
After I set the codepage to 65001, the next time i call chcp it should say the active codepage is 65001, not 437. I tried this in windows command prompt and it worked.
Why ...
Hello,
I have problems determining valid Java package names using Python. Here's the code:
packageName = "com.domain.lala" # valid, not rejected -> correct
#packageName = ".com.domain.lala" # invalid, rejected -> correct
#packageName = "com..domain.lala" # invalid, not rejected -> incorrect
#packageName = "com.domain.la...
I'm playing around with Python 3's sqlite3 module, and acquainting myself with SQL in the process.
I've written a toy program to hash a salted password and store it, the associated username, and the salt into a database. I thought it would be intuitive to create a function of the signature:
def store(table, data, database=':memory:')
...
Hi, I would like to implement a button "New" that would work the same as File>New in most applications - that is: resets all the labels, treeviews, etc. to the original state.
Thank you, Tomas
...
My program work fine on windows, with cpickle, and I am using binary mode, like 'wb', or 'rb'. When I ran my program on Linux, it still works fine.
But when I tried to unpickle the files obtained from the Linux platform on my windows platform, I got this wired message says: cPickle.UnpicklingError: invalid load key'
'.
Can anyone plea...