Here is the problem:
for your reference: http://www.freeimagehosting.net/uploads/b443e7a1fe.jpg
database entries 1,2 and 3 are made using jython 2.2.1 using jdbc1.2.
database entry 4 is made using vb the old to be replace program using odbc.
We have found that if I copy and paste both jython and vb MailBody entries to wordpad directl...
If i had a dictionary 'dict' and I wanted to check for dict['key'] I could either do so in a try block (bleh!) or use the get() method, with False as a default value.
I'd like to do the same thing for object.attribute. That is, I already have object to return False if it hasn't been set, but then that gives me errors like
AttributeErro...
I am writing a crawler in Python, in order to make Ctrl+C not to cause my crawler to start over in next run, I need to save the processing deque in a text file (one item per line) and update it every iteration, the update operation needs to be super fast. In order not to reinvent the wheel, I am asking if there is an established module t...
I need a way to compute the nth root of a long integer in python.
I tried pow(n, 1.0/3), but obviously it doesn't work any ideas ?
UPDATE:
By long integer i mean REALLY long ints like:
11968003966030964356885611480383408833172346450467339251
196093144141045683463085291115677488411620264826942334897996389
4850462628472657692808832376...
Hello all,
I'm having a very peculiar problem in my Python FastCGI code - sys.stdout has a file descriptor of '-1', so I can't write to it.
I'm checking this at the first line of my program, so I know it's not any of my code changing it.
I've tried sys.stdout = os.fdopen(1, 'w'), but anything written there won't get to my browser.
The...
Hi, I have to program a game engine starting very soon for a 3rd year Games technology project. As a part of our project we have to integrate a scripting language for scripting our NPCs and other elements of the game.
I know that Lua has been very popular in recent years and Python has horrible white space issues, however it is making a...
In python do you generally use PEP 8 -- Style Guide for Python Code as your coding standards/guidelines? Are there any other formalized standards that you prefer?
...
Hi all, what are your advices on building a very minimalistic version of Python(2.x) for my application's scripting needs.
My main motive here is to keep the foot print (both memory and disk wise) as low as possible so that my native application won't suffer from any major performance hit. Even the Python DLL size is in consideration b...
Hi, I'm using re.findall() to extract some version numbers from an HTML file:
>>> import re
>>> text = "<table><td><a href=\"url\">Test0.2.1.zip</a></td><td>Test0.2.1</td></table> Test0.2.1"
>>> re.findall("Test([\.0-9]*)", text)
['0.2.1.', '0.2.1', '0.2.1']
but I would like to only get the ones that do not end in a dot.
The filename ...
How would you define your parser and lexer rules to parse a language that uses indentation for defining scope.
I have already googled and found a clever approach for parsing it by generating INDENT and DEDENT tokens in the lexer.
I will go deeper on this problem and post an answer if I come to something interesting, but I would like to...
Is there a way in Python, to have more than one constructor or more than one method with the same name, who differ in the number of arguments they accept or the type(s) of one or more argument(s)?
If not, what would be the best way to handle such situations?
For an example I made up a color class. This class should only work as a basic...
I'm doing a Python script where I need to spawn several ssh-copy-id processes, and they need for me to type in a password, so i'm using PExpect.
I have basically this:
child = pexpect.spawn('command')
child.expect('password:')
child.sendline('the password')
and then I want to spawn another process, I don't care about this one anymore...
Hi!
(I'm using the pyprocessing module in this example, but replacing processing with multiprocessing should probably work if you run python 2.6 or use the multiprocessing backport)
I currently have a program that listens to a unix socket (using a processing.connection.Listener), accept connections and spawns a thread handling the requ...
I am interested in enabling code folding in vim for python coding.
I have noticed multiple ways to do so.
Does anyone have a preferred way to do python code folding in vim?
I.e,
do you have a particular vim plugin that you use and like?
do you use manual folding or do you place markers in comments?
any other recommended ways to do c...
I am a beginner of python and have a question, very confusing for me.
If I define a function first but within the function I have to use a variable which is defined in another function below, can I do it like this? Or how can I import the return things of another function into a function?
for example:
def hello(x,y):
good=hi(iy,ix)
...
I would like to automatically align lines of python variable assignments in vim.
For example I would like to change this:
a = 1
banana = 2
into this
a = 1
banana = 2
automatically in vim.
Is there a way to do this?
...
I am working on Conway's Game of Life currently and have gotten stuck. My code doesn't work.
When I run my code in GUI, it says:
[[0 0 0 0]
[0 1 1 0]
[0 1 0 0]
[0 0 0 0]]
Traceback (most recent call last):
File "C:\Users\Documents\Physics\Python\MainProject\conway.py", line 53, in
b= apply_rules(a)
File "C:\Users\Documen...
In Java you can define a new class inline using anonymous inner classes. This is useful when you need to rewrite only a single method of the class.
Suppose that you want create a subclass of OptionParser that overrides only a single method (for example exit()). In Java you can write something like this:
new OptionParser () {
publi...
I have some Python code which I am finding difficult to read and I don't really want to learn the Python syntax if I can help it.
Can someone point me to a Python to C# converter?
...
Is it possible to use any chart modules with wxpython? And are there any good ones out there?
I'm thinking of the likes of PyCha (http://www.lorenzogil.com/projects/pycha/) or any equivalent. Many modules seem to require PyCairo, but I can't figure out if I can use those with my wxpython app.
My app has a notebook pane, and I'd like to...