I am looking at the soaplib python module (it comes with standard ubuntu 9.04). I have used xmlrpclib extensively in the last years but now I am curious about soap. writing servers with soaplib is acceptably easy, I assume writing clients should be even easier.
in my impatience I can't find a way to make use of introspection. do I re...
I was wondering if there are any opensource libraries that are geared towards transportation ben/cost analysis.
I currently use microBENCOST and would like to build my own solution. I'm most comfortable with C/c++ and Python.
cheers
...
hello,
I am new to Python. I have Python2.6 running now. I am following the Tutorial on the Python site. My question is when I try to follow the instructions here:
http://py-psycopg.darwinports.com/
I get something like...
sudo port install py-psycopg
... bunch of errors here...
Error: The following dependencies failed to build: py-m...
I'm trying to create an xml entry that looks like this using python and lxml:
<resource href="Unit 4.html" adlcp:scormtype="sco">
I'm using python and lxml. I'm having trouble with the adlcp:scormtype attribute. I'm new to xml so please correct me if I'm wrong. adlcp is a namespace and scormtype is an attribute that is defined in t...
Is there a way that I can find out how many matches of a regex are in a string in Python? For example, if I have the string "It actually happened when it acted out of turn."
I want to know how many times "t a" appears in the string. In that string, "t a" appears twice. I want my function to tell me it appeared twice. Is this possible?
...
I have a python script the runs this code:
strpath = "sudo svnadmin create /svn/repos/" + short_name
os.popen (strpath, 'w')
How can I get the output of that command stored in a variable or written to a log file in the current directory?
I know, there may not be an output, but if there is, I need to know.
...
Hello,
I am attempting to wrap some C code in Python using Pyrex. I've run into an issue with defining two structs. In this case, the structures have been defined in terms of one another, and Pyrex cannot seem to handle the conflict. The structures look something like so:
typedef struct a {
b * b_pointer;
} a;
typedef struct b ...
In my Django project, the following line throws an ImportError: "No module named elementtree".
from elementtree import ElementTree
However, the module is installed (ie, I can run an interactive python shell, and type that exact line without any ImportError), and the directory containing the module is on the PYTHONPATH. But when I a...
After I begin the polling loop, all messages printed after the first iteration require me to press enter in the terminal for it to be displayed.
#!/usr/bin/python
import socket, select, os, pty, sys
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('', 5007))
s.listen(5)
mypoll = select.poll()
mypoll.register(s.fileno() )
...
I am trying to create a simple Python module for MySQL Workbench 5.1.17 SE however I cannot seem to register the module, that is, it is not displaying under the Plugins->Catalog menu.
The documentation appears to be rather weak at this time, the best I have found is Python Scripting in Workbench. There isn't much in the way of instruct...
If lv stores a long value, and the machine is 32 bits, the following code:
iv = int(lv & 0xffffffff)
results an iv of type long, instead of the machine's int.
How can I get the (signed) int value in this case?
...
I have a function that takes a string-like argument.
I want to decide if I can safely store the argument and be sure that it won't change. So I'd like to test if it's mutable, e.g the result of a buffer() built from an array.array(), or not.
Currently I use:
type(s) == str
Is there a better way to do it?
(copying the argument is to...
I was playing around with Python's subprocess module, trying a few examples but I can't seem to get heredoc statements to work.
Here is the trivial example I was playing with:
import subprocess
a = "A String of Text"
p = subprocess.Popen(["cat", "<<DATA\n" + a + "\nDATA"])
I get the following error when I run the code above:
cat: <<...
i'm doing application that locks the PC using pyGtk, but i have a problem, when i click on the ok button the function of the button should get the time from the textbox, hide the window then sleep for a while, and at last lock the pc using a bash command. but it just don't hide.
and here is the complete program
...
I want to do some web scraping with GAE. (Infinite Campus Student Information Portal, fyi). This service requires you to login to get in the website.
I had some code that worked using mechanize in normal python. When I learned that I couldn't use mechanize in Google App Engine I ended up using urllib2 + ClientForm. I couldn't get it to l...
How do you make a repeating generator, like xrange, in Python? For instance, if I do:
>>> m = xrange(5)
>>> print list(m)
>>> print list(m)
I get the same result both times — the numbers 0..4. However, if I try the same with yield:
>>> def myxrange(n):
... i = 0
... while i < n:
... yield i
... i += 1
>>> m = myxrange(5)
...
I keep getting this intermittent error when trying to send through 'smtp.gmail.com'.
Traceback (most recent call last):
File "/var/home/ptarjan/django/mysite/django/core/handlers/base.py", line 92, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/var/home/ptarjan/django/mysite/registratio...
I'm trying to implement an indexed accessor method for my model class in Python, as per the KVC guide. I want to use the optional ranged method, to load multiple objects at once for performance reasons. The method takes a pointer to a C-array buffer which my method needs to copy the objects into. I've tried something like the following, ...
Like if I have a string like str1 = "IWantToMasterPython"
If I want to extract "Py" from the above string. I write:
extractedString = foo("Master","thon")
I want to do all this because i am trying to extract lyrics from an html page. The lyrics are written like <div class = "lyricbox"> ....lyrics goes here....</div>.
Any suggestions...
I'm trying to write something that will parse some code. I'm able to successfully parse foo(spam) and spam+eggs, but foo(spam+eggs) (recursive descent? my terminology from compilers is a bit rusty) fails.
I have the following code:
from pyparsing_py3 import *
myVal = Word(alphas+nums+'_')
myFunction = myVal + '(' + delimitedList( ...