In my C++ code I have a class Foo with many methods taking a Bar type variable as an argument:
class Foo {
public:
void do_this(Bar b);
void do_that(Bar b);
/* ... */
};
Bar has a number of constructors that create a new object from many common types such as int, std::string, float, etc:
class Bar {
public:
Bar(int i);
Bar(...
Since Python 2.6 is backward compatible to 2.52 , did anyone succeeded in using it with Google app Engine ( which supports 2.52 officially ).
I know i should try it myself. But i am a python and web-apps new bee and for me installation and configuration is the hardest part while getting started with something new in this domain.
( .......
When I run doctests on different Python versions (2.5 vs 2.6) and different plattforms (FreeBSD vs Mac OS) strings get quoted differently:
Failed example:
decode('{"created_by":"test","guid":123,"num":5.00}')
Expected:
{'guid': 123, 'num': Decimal("5.00"), 'created_by': 'test'}
Got:
{'guid': 123, 'num': Decimal('5.00'), 'cre...
In python, one can trace all the statements that are executed by a command line script using the trace module. In bash you can do the same with set -x. We have a PHP script that we're running from the command line, like a normal bash / python / perl / etc script. Nothing web-y is going on.
Is there anyway to get a trace of all the lines...
I am trying to post a multi-part form using httplib, url is hosted on google app engine, on post it says Method not allowed, though the post using urllib2 works. Full working example is attached.
My question is what is the difference between two, why one works but not the other
is there a problem in my mulipart form post code?
or the ...
I have a Python script using shutil.copy2 extensively. Since I use it to copy files over the network, I get too frequent I/O errors, which lead to the abortion of my program's execution:
Traceback (most recent call last):
File "run_model.py", line 46, in <module>
main()
File "run_model.py", line 41, in main
tracerconfigfile=...
I know it can be done, but I never remember how.
How can you reimport a module in python?
The scenario is as follows: I import a module interactively and tinker with it, but then I face an error. I fix the error in the .py file and then I want to reimport the fixed module without quitting python. How can I do it ?
...
is there any python api which can fetch the public key from the public key server....
let me know
thnks
...
I'm receiving a dict from one "layer" of code upon which some calculations/modifications are performed before passing it onto another "layer". The original dict's keys & "string" values are unicode, but the layer they're being passed onto only accepts str.
This is going to be called often, so I'd like to know what would be the fastest w...
Is there a way to make Python's optparse print the default value of an option or flag when showing the help with --help?
...
It's not the same to POST to an URL than to GET it, DELETE it or PUT it. These actions are fundamentally different. However, Django seems to ignore them in its dispatch mechanism. Basically, one is forced to either ignore HTTP verbs completely or do this on every view:
def my_view(request, arg1, arg2):
if request.method == 'GET':
...
Hi,
I'm trying to integrate an old PHP ad management system into a (Django) Python-based web application. The PHP and the Python code are both installed on the same hosts, PHP is executed by mod_php5 and Python through mod_wsgi, usually.
Now I wonder what's the best way to call this PHP ad management code from within my Python code in ...
How to create a non-editable text box with no cursor in wxPython to dump text in?
...
How do I validate XML document via compact RELAX NG schema in Python?
...
Hi all,
I'm just wondering why I my registered an atexit function... e.g.
import atexit
atexit.register(somefunc)
...
AppHelper.runEventLoop()
Of course I know when will atexit won't work. When I comment out AppHelper.runEventLoop() the atexit function gets called. I also browsed my pyobjc egg, and I saw under __init__.py under objc ...
I have a service that is running (Twisted jsonrpc server). When I make a call to "run_procs" the service will look at a bunch of objects and inspect their timestamp property to see if they should run. If they should, they get added to a thread_pool (list) and then every item in the thread_pool gets the start() method called.
I have ...
I am looking for some way in django's development server that will make the server to stop at any uncaught exception automatically, as it is done with pdb mode in ipython console.
I know to put import pdb; pdb.set_trace() lines into the code to make application stop. But this doesn't help me, because the line where the exception is thro...
Hi,
I have no: of arrays, and i like to take it to text file in specific format, for eg.,
'present form'
a= [1 2 3 4 5 ]
b= [ 1 2 3 4 5 6 7 8 ]
c= [ 8 9 10 12 23 43 45 56 76 78]
d= [ 1 2 3 4 5 6 7 8 45 56 76 78 12 23 43 ]
The 'required format' in a txt file,
a '\t' b '\t' d '\t' c
1 '\t' 1
2...
Here's some code from Richard Jones' Blog:
with gui.vertical:
text = gui.label('hello!')
items = gui.selection(['one', 'two', 'three'])
with gui.button('click me!'):
def on_click():
text.value = items.value
text.foreground = red
My question is: how the heck did he do this? How can the conte...
I have written information to a file in python using struct.pack
eg.
out.write( struct.pack(">f", 1.1) );
out.write( struct.pack(">i", 12) );
out.write( struct.pack(">3s", "abc") );
Then I read it in java using DataInputStream and readInt, readFloat and readUTF.
Reading the numbers works but as soon as I call readUTF() I get EOFExcept...