python

bulkloader.py --dump without authentication

Is there some way or using the bulkloader.py dump and restore funtionality without authentication? I have tried using: - url: /remote_api script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py without the login-parameter, but login still seems to be required. I still get [ERROR ] Exception during authentication I strugg...

Linux group scheduling for user not being applied to setuid-ed process

On the 2.6.28-11 Linux kernel, I am using setpriority to bias the amount of cpu time different user processes receive. User 1 is to receive double the CPU power of user 2. Using Linux's setpriority, I have assigned user 2 a lower priority (higher in terms of nice values). When I run the exact same program via the shell with the computer ...

how can i run a python script on windows??

Can anyone plz tell me an IDE for running python programs. Is it possible to run the program through command line? ...

Python many-to-one mapping (creating equivalence classes)

Hi, I have a project of converting one database to another. One of the original database columns defines the row's category. This coulmn should be mapepd to a new category in the new databse. For example, let's assume the original categories are:parrot, spam, cheese_shop, Cleese, Gilliam, Palin Now that's a little verbose for me, And ...

Loop thru text file and compare two lines

Hi, I´m trying to read from a file, and then see if 2 Lines in there are equal if so then break the while loop. I cant recive the information from line2. In other words if line1==line2. In anywhere in the file. example: line1 = [0,2,3,5,6], line2=[0,2,3,5,6] I have used the readin code in a another file, and works like a charm. But not...

The best solution for distribution website?

Ok, I have a question from a "client" perspective. Let's say we are talking about website designed for distribution: products + their logistics info. Definitely less than a 2k rows, rarely changed but often accessed. Typical row with several columns will have to consist of a picture so it might make it a bit "heavy". I was proposed a w...

XML edit attributes

Hi, I want to edit the attributes of an element in an XML file. The file looks like <Parameter name="Spec 2 Circumference/Length" type="real" mode="both"> <Value>0.0</Value> <Result>0.0</Result> </Parameter> I want to replace the value and Result attribute with some other value from a text file. Please suggest. Thanks in ...

How do I get names of subdirectories of a directory purely in python ?

I dont want to use commands or any similar module that uses unix shell. Thanks in advance.. ...

Python - Should one start a new project directly in Python 3.x?

What Python version can you please recommend for a long-term (years) project? Should one use 2.6+ or 3.x is already stable? (only standard libraries are required) UPDATE: according to the answers below, Python 3.x still has critical bugs. Please also see Python's list of bugs. ...

Grep and Python

I need a way of searching a file using grep via a regular expression 'RE' from the unix command line. For example when i type in the command line: python pythonfile.py 'RE' 'file-to-be-searched' I need the regualr expression 'RE' to be searched in the file and print out the lines that contain the RE. Ok so heres the coding i hav...

Parsing HTML in python - lxml or BeautifulSoup? Which of these is better for what kinds of purposes?

From what I can make out, the two main HTML parsing libraries in Python are lxml and BeautifulSoup. I've chosen BeautifulSoup for a project I'm working on, but I chose it for no particular reason other than finding the syntax a bit easier to learn and understand. But I see a lot of people seem to favour lxml and I've heard that lxml is f...

Indexing over the results returned by selenium

Hi I try to index over results returned by an xpath. For example: xpath = '//a[@id="someID"]' can return a few results. I want to get a list of them. I thought that doing: numOfResults = sel.get_xpath_count(xpath) l = [] for i in range(1,numOfResults+1): l.append(sel.get_text('(%s)[%d]'%(xpath, i))) would work because doing som...

Python: when to use pty.fork() versus os.fork()

I'm uncertain whether to use pty.fork() or os.fork() when spawning external background processes from my app. (Such as chess engines) I want the spawned processes to die if the parent is killed, as with spawning apps in a terminal. What are the ups and downs between the two forks? ...

nested regular expressions in python

In perl I can do this: $number = qr/ zero | one | two | three | four | five | six | seven | eight | nine /ix; $foo = qr/ quantity: \s* $number /ix; My actual regular expression is many lines and does two-digit and ordinal numbers (e.g., "twenty-two", "forty-fourth" and "twelve are all complete matches), and I use it in several places....

Testing subpackage modules in Python 3

I have been experimenting with various uses of hierarchies like this and the differences between absolute and relative imports, and can't figure out how to do routine things with the package, subpackages, and modules without simply putting everything on sys.path. I have a two-level package hierarchy: MyApp __init__.py ...

Which editor/IDE should I use for Python?

Possible Duplicate: What IDE to use for Python I have Notepad++ and NetBeans 6.8, however I don't know if they work. I know you can edit Python with Notepad++ and compile/run it using the command line thing, but I'm not really sure how. I know NetBeans is a full-featured IDE and you can compile Java programs, but I don't think t...

Good Python Libraries for iPod Synchronization

I am making a music application, and want to be able to synchronize with the iPod from my application. Has anyone had any experience in doing this with python, and if so what would you recommend? ...

Parsing a datafile in python (2.5.2)

I have a message definition file that looks like this struct1 { field="name" type="string" ignore="false"; field="id" type="int" enums=" 0="val1" 1="val2" "; } struct2 { field = "object" type="struct1"; ... } How can I parse this into a dictionary with keys 'struct1, struct2' and values should be a list of dictionaries, eac...

Huge amount of time sending data with suds and proxy

Hi everyone, I have the following code to send data through a proxy using suds: import suds t = suds.transport.http.HttpTransport() proxy = urllib2.ProxyHandler({'http': 'http://192.168.3.217:3128'}) opener = urllib2.build_opener(proxy) t.urlopener = opener ws = suds.client.Client('http://xxxxxxx/web.asmx?WSDL', transport=t) re...

MYSQLDB python module

Team, I am using MySQLdb module of python on FC11 machine. Here, i have an issue. I have the following implementation for one of our requirement: connect to mysqldb and get DB handle,open a cursor, execute a delete statement,commit and then close the cursor. Again using the DB handle above, iam performing a "select" statement one some...