Hi,
I am looking for a python SOAP 1.2 client but it seems that it does not exist . All of the existing clients are either not maintainted or only compatible with SOAP 1.1:
suds
SOAPpy
ZSI
Given a PyObject* pointing to a python object, how do I invoke one of the object methods? The documentation never gives an example of this:
PyObject* obj = ....
PyObject* args = Py_BuildValue("(s)", "An arg");
PyObject* method = PyWHATGOESHERE(obj, "foo");
PyObject* ret = PyWHATGOESHERE(obj, method, args);
if (!ret) {
// check error...
}
This would be the equivalent of
>>> ret = obj.foo("An arg")
Cant download any pyhton windows modules and install. I wanted to experiment with scrapy framework and stackless but unable to install due to error "Python veIrsion 2.6 required, which was not found in the registry".
Trying to install it to
Windows 7, 64 bit machine
I am creating an application that lets users login using Google, Facebook and the website's native login. The site is being built in Python / Django.
What would be the best way to handle login, session management and user authentication?
I do not want to use the in-built Django user management. I am using Django very sparingly(URLs, templates)
Is there some relatively simple way to programmatically include source code lines to python logger report. For example...
import logging
def main():
something_is_not_right = True
logging.basicConfig(level=logging.DEBUG,
format=('%(filename)s: '
'%(levelname)s: '
'%(funcName)s(): '
'%(lineno)d:\t'
'%(message)s')
)
if something_is_not_right == True:
logging.debug('some way to get previous line of source code here?')
So that output would look like this.
example.py: DEBUG: main(): 14: if something_is_not_right == True:
I have a string of HTML stored in a database. Unfortunately it contains characters such as ®
I want to replace these characters by their HTML equivalent, either in the DB itself or using a Find Replace in my Python / Django code.
Any suggestions on how I can do this?
I'd like to work with a dict in python, but limit the number of key/value pairs to X. In other words, if the dict is currently storing X key/value pairs and I perform an insertion, I would like one of the existing pairs to be dropped. It would be nice if it was the least recently inserted/accesses key but that's not completely necessary.
If this exists in the standard library please save me some time and point it out!
Hi,
I am planning to write a generic python module for installing a package. This script should retrieve the module from a remote machine or locally and install it on a given host and user. However, there needs to be changes made to the package files based on the host, user and given environment.
My approach is to use XML to describe changes to be made to package files based on environment. It will first extract the package to the user directory and then using an xml configuration file, it should replace the file values in the package directory. The xml would look something like this:
<package version="1.3.3">
<environment type="prod">
<file dir="d1/d2" name="f1">
<var id="RECV_HOST" value="santo">
<var id="RECV_PORT" value="RECV_PORT_SERVICE" type="service">
<var id="JEPL_SERVICE_NAME" value="val_omgact">
</file>
<var dir="d4/d3/s2" name="f2">
<var id="PRECISION" value="true">
<var id="SEND_STATUS_CODE" value="323">
<var id="JEPL_SERVICE_NAME" value="val_omgact">
</file>
</environment>
<environment type="qa">
<file dir="d1/d2" name="f1">
<var id="RECV_HOST" value="test">
<var id="RECV_PORT" value="1444">
<var id="JEPL_SERVICE_NAME" value="val_tsdd">
</file>
<file dir="d4/d3/s2" name="f2">
<var id="PRECISION" value="false">
<var id="SEND_STATUS_CODE" value="323">
<var id="JEPL_SERVICE_NAME" value="val_dsd">
</file>
</environment>
</package>
What are your thoughts on this approach? Is there an existing python module, package or script that I could use for this purpose since this seems fairly generic and can be used for any installation.
Thanks!
Sam
how to traverse a binary decision tree using python language.
given a tree,i want know how can we travesre from root to required leaf
the feature of the required leaf are given in an dictionary form assume and have to traverse from root to leaf answering the questions at each node with the details given in feature list..
the decision tree node has format ((question)(left tree)(right tree))
while traversing it should answer question at each node and an choose left or right and traverse till leaf?
Windows XP, Python 2.5:
hash('http://stackoverflow.com') Result: 1934711907
Google App Engine (http://shell.appspot.com/):
hash('http://stackoverflow.com') Result: -5768830964305142685
Why is that? How can I have a hash function which will give me same results across different platforms (Windows, Linux, Mac)?
I'm writing a Python application, that I want to later migrate to GAE.
The new "Task Queues" API fulfills a requirement of my app, and I want to simulate it locally until I have the time to migrate the whole thing to GAE.
Does anyone know of a compatible module I can run locally?
I am using Python with PLY to parse LISP-like S-Expressions and when parsing a function call there can be zero or more arguments. How can I put this into the yacc code. This is my function so far:
def p_EXPR(p):
'''EXPR : NUMBER
| STRING
| LPAREN funcname [EXPR] RPAREN'''
if len(p) == 2:
p[0] = p[1]
else:
p[0] = ("Call", p[2], p[3:-1])
I need to replace "[EXPR]" with something that allows zero or more EXPR's. How can I do this?
I have
stringA = "xxxxxxFoundAaaaaaaaaaaaaaaFoundBxxxxxxx"
stringB = "FoundA"
stringC = "FoundB"
How do I do a regular expression in python in order to return aaaaaaaaaaaaaa?
Please help.
Thanks in advance.
Using python and wsgiref.handlers, I can get a single variable from a form with self.handler.request.get(var_name), but how do I iterate through all form variables, be they from GET and POST? Is it something like this?
for field in self.handler.request.fields:
value = self.handler.request.get(field)
Again, it should include both fields included in the POST and fields from the query string, as in a GET request.
Thanks in advance folks...
I wrote PyQt application. After it's start I close it (GUI), but timer don't stops and Python sometimes freezes. Only thing to unfreeze it - Ctrl-C, after which following message appears:
Traceback (most recent call last):
File "", line 262, in timerEvent
KeyboardInterrupt
timer don't stops again, and CPython works very slowly. How to avoid this problem?
how can I use wild cars like '*' when getting a list of files inside a directory in Python? for example, I want something like:
os.listdir('foo/*bar*/*.txt')
which would return a list of all the files ending in .txt in directories that have bar in their name inside of the foo parent directory.
how can I do this?
thanks.
Hi there,
I'm trying to find information on different ways to traverse an object tree in python.
I don't know much about the language in general yet, so any suggestions/techniques would be welcome.
Thanks so much
jml
Hi,
I was going over some pages from WikiVS, that I quote from:
because lambdas in Python are restricted to expressions and cannot contain statements
I would like to know what would be a good example (or more) where this restriction would be, preferably compared to the Ruby language.
Thank you for your answers, comments and feedback!
im trying to build android from source on ubuntu 10.04. when i enter the repo command:
repo init -u git://android.git.kernel.org/platform/manifest.git -b eclair
it get this error back
exec: 23: python: not found
any ideas.
Let's say that I have the following text:
in = "one aaa two bbbb three cccc"
I would like to parse this into a group of variables that contain
notworking = ["one", "two", "three"]
v1,v2,v3 = in.split(notworking)
I know that the example above won't work, but is there some utility in python that would allow me to use this sort of approach? I know what the identifiers will be in advance, so I would think that there has got to be a way to do this...
Thanks for any help,
jml
I have two floats in Python that I'd like to subtract, i.e.
v1 = float(value1)
v2 = float(value2)
diff = v1 - v2
I want "diff" to be computed upto two significant figures, that is compute it using %.2f of v1 and %.2f of v2. How can I do this? I know how to print v1 and v2 up to two decimals, but not how to do arithmetic like that.
thanks.
I'm using the following code to hide stderr on Linux/OSX for a Python library I do not control that writes to stderr by default:
f = open("/dev/null","w")
zookeeper.set_log_stream(f)
Is there an easy cross platform alternative to /dev/null? Ideally it would not consume memory since this is a long running process.
Hi
I have a list of points as shown below
points=[ [x0,y0,v0], [x1,y1,v1], [x2,y2,v2].......... [xn,yn,vn]]
Some of the points have duplicate x,y values. What I want to do is to extract the unique maximum value x,y points
For example, if I have points [1,2,5] [1,1,3] [1,2,7] [1,7,3]
I would like to obtain the list [1,1,3] [1,2,7] [1,7,3]
How can I do this in python
Thanks
Can we initialize python objects with statement like this:
a = b = c = None
it seems to me when I did a = b = c = list() will cause circular reference count issue.
Please give your expert advice.