python

How can we use ms office communicator client exposed APIs in python, is that possible ?

I want to use ms office communicator client apis, and i wan to use those in python is it possible to do ? ...

Recursive splitting of path name (in Python)?

Hi, I feel that there is (should be?) a Python function out there that recursively splits a path string into its constituent files and directories (beyond basename and dirname). I've written one but since I use Python for shell-scripting on 5+ computers, I was hoping for something from the standard library or simpler that I can use on-th...

Python : updating values in a dictionary

I have the following dictionary -> key : (time,edge_list) Now I want to increment all time values by 1. How do I do that? dict_list = dict(key:(time+1,edge_list) for key:(time,edge_list) in dict_list) ...

How to do I integrate a 304 in Django?

When a user requests the same page, with the same data...I'd like Django to return a 304, so that the browser doesn't have to load the page all over again. I'm new to this. How can this be done? Thanks. ...

How to run nosetests from netbeans?

I recently started using netbeans for python development and really like it. However, the test runner in netbeans does not run my doctests, nor does it run my test functions written using nose. I always have to switch to the shell and run 'setup.py test' or 'nosetests' manually. Is there a way to integrate this into netbenas 6.8? ...

Mercurial installation issue

We've installed mercurial 1.4.1 and python 2.6.2 on a solaris 8 box. Now some hg commands work as expected, others fail. I was able to initialize a repository (hg init) and add a file (hg add) but the committing (hg commit) leads to an error message: abort: could not import module found! I need a hint where to look - I'm not a python...

C++ - How to read Unicode characters( Hindi Script for e.g. ) using C++ or is there a better Way through some other programming language?

Hi:) I have a hindi script file like this: 3. भारत का इतिहास काफी समृद्ध एवं विस्तृत है। I have to write a program which adds a position to each and every word in each sentence. Thus the numbering for every line for a particular word position should start off with 1 in parentheses. The output should be something like this. 3. भारत...

Trouble using PIL with Google Appengine SDK

I have a Windows Server 2008 R2 (64bits) machine on which I wanted to develop a google AppEngine app. So I installed Python 2.5.4 from python.org (because the Google SDK said I needed 2.5 and 2.5.6 didn't have any MSI's) Then I installed PIL from http://www.pythonware.com/products/pil/ I used version 1.1.7 for python 2.5 I used the 32-...

Enumerate CD-Drives using Python (Windows)

How can I find out the drive letters of available CD/DVD drives? I am using Python 2.5.4 on Windows. Thanks in advance. ...

What are some good ways to do connection management in C?

In C, when making a networking client / server setup, I usually have to do some standard BSD socket setup. Then on the server side, I'll have to manage multiple threads, usually a main thread, an a io thread. Each connection is managed by a connection manager so that you can have connections being processed while new requests are coming ...

python: two way partial credit card storing encrytion

Hello, For my ecommece site, I want to store partial credit card numbers as string, for this I need to encrypt the information to store at the database and decrypt when users want to reuse the already entered credit card info from earlier purchases without typing it all over again. I am using Django thus I need to solve this via Python....

Disable Plone Archetypes index/convert doc/pdf files

Hi Stackoverflowers, if i rebuild my catalog in plone i get many of this infos: 2010-02-18T11:26:09 INFO Archetypes Error while trying to convert file contents to 'text/plain' in .getIndexable() of : Unable to find binary "wvHtml" in /sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games:/usr/lib/jvm/jre...

How can I work with base 5 numbers in Python?

Possible Duplicate: convert integer to a string in a given numeric base in python I want to work with base 5 numbers, or any other non standard base for that matter. I found out int('123', 5) works, but I need to go the other way around. Should I write my own number class to accomplish this? Maybe I'm just thinking in the ...

Install python egg in buildout environment including data files

This question assumes that the python package I want to install is a django app that includes templates and media files. But the question is valid for any python package that does not only contain .py files. I'm using buildout to create a re-buildable environment in which I'm developing a django project. My buildout.cfg looks like that:...

Content of file to tree format using python

I have a file containing a file "dir.txt" with the below data: /home/abc/a.txt /home/abc/b.txt /home/xyz/test /home/xyz/test/d.txt /home/xyz/test/e.txt /home/xyz/test/f.txt /home/xyz /home/xyz/g.txt I want to parse the file and get the output like /home/abc/a.txt b.txt /home/xyz/test/d.txt e.txt ...

What's wrong in this caching function in Django?

I've created the model for counting the number of views of my page: class RequestCounter(models.Model): count = models.IntegerField(default=0) def __unicode__(self): return str(self.count) For incrementing the counter I use: def inc_counter(): counter = RequestCounter.objects.get_or_create(id =1)[0] counter.co...

Problem with running Django 1.1.1 on Google App Engine Developement Server

I've downloaded google_appengine version 1.3.1. Using some web tutorials, I've created basic django 1.1.1 application. Using appcfg I managed to deploy it on GAE and it works. The problem is, that application doesn't want to work on dev_appengine.py developement server. Whenever I run the app GAE local server is returning HTTP 200 witho...

Effective ways to implement Every-to-Every interaction?

Given a list of elements, how to process all elements if every element requires knowledge about states of every other element of this list? For example, direct way to implement it in Python could be: S = [1,2,3,4] for e in S: for j in S: if e!=j: process_it(e,j) but it is very slow O(n²) if number of elements is huge. Th...

Wrong results with Python multiply() and prod()

Hi, Can anyone explain the following? I'm using Python 2.5 Consider 1*3*5*7*9*11 ... *49. If you type all that from within IPython(x,y) interactive console, you'll get 58435841445947272053455474390625L, which is correct. (why odd numbers: just the way I did it originally) Python multiply.reduce() or prod() should yield the same resul...

What is the difference between running a script from the command line and from exec() with PHP?

I'm trying to run a Python script using exec() from within PHP. My command works fine when I run it directly using a cmd window, but it produces an error when I run it from exec() in PHP. My Python script uses NTLK to find proper nouns. Example command: "C:\Python25\python.exe" "C:\wamp\projects\python\trunk\tests\find_proper_nouns.py"...