python

What programming language are used for these websites ?

What programming language or web Framework are used for these websites ? Google Amazon MySpace Yahoo Flickr PayPal Ebay Python If you know only one of this, please comment :) !! ...

How to send a package to PyPi?

hi, i wrote a little module and i would like to know what are the basic steps to package it in order to send it to pipy: what is the file hierarchy? how should i name files? should i use distutils to create PKG-INFO? where should i include my documentation (made with sphinx)? ...

Does "Find-Replace whole word only" exist in python?

Does "Find-Replace whole word only" exist in python? e.g. "old string oldstring boldstring bold" if i want to replace 'old' with 'new', new string should look like, "new string oldstring boldstring bold" can somebody help me? ...

Adding objects to queue without interruption

I would like to put two objects into a queue, but I've got to be sure the objects are in both queues at the same time, therefore it should not be interrupted in between - something like an atomic block. Does some one have a solution? Many thanks... queue_01.put(car) queue_02.put(bike) ...

Figure out nested submenu selections in wxPython?

Let's say in a larger submenu structure with a depth of 3 levels, I have selected 'car' in the first level, 'type' in the second, and 'suv' in the third and last level. Is there any way I can figure all these three selections in my def OnPopupItemSelected(self, event) method? I hope I have made myself clear enough, if not, please add a ...

Django model per table vs model per select

Hey, I am working with Django for a while and now that my "tree" and whole DB is filled with data (note: existing database), I was wondering if the "one model per table" is really better at this point than "one model per select". I have got one table - objtree. This is the place where I have all nodes (brands, categories, tags, etc.) ...

Bulk insert with sqlAlchemy ORM

Is there any way to get sqlalchemy to do a bulk insert rather than inserting each individual object. i.e., doing: INSERT INTO `foo` (`bar`) VALUES (1), (2), (3) rather than: INSERT INTO `foo` (`bar`) VALUES (1) INSERT INTO `foo` (`bar`) VALUES (2) INSERT INTO `foo` (`bar`) VALUES (3) I've just converted some code to use sqlalchemy...

Is it possible to stream a windows (7 / vista / xp) webcams via Gstreamer.

Hello, I very new to the world of gstreamer. I was wondering, if it's possible to stream windows webcam via gstreamer? The only package i have seen so far is for linux. v4l2 (video for linux). Is there also a package for windows webcams? what is the correct python syntax? DJ ...

Can i control PSFTP from a Python script?

Hi, i want to run and control PSFTP from a Python script in order to get log files from a UNIX box onto my Windows machine. I can start up PSFTP and log in but when i try to run a command remotely such as 'cd' it isn't recognised by PSFTP and is just run in the terminal when i close PSFTP. The code which i am trying to run is as follo...

Why does django not see my tests ?

I've created test.py module, filled with from django.test import TestCase from django.test.client import Client from django.contrib.auth.models import User from django.contrib.sites.models import Site from forum.models import * class SimpleTest(TestCase): def setUp(self): u = User.objects.create_user("ak", "[email protected]", ...

How to By pass WP super cache using python?

Hi guys. I'm trying to collecting data from a frequently updating blog, so I simply use a while loop which includes urllib2.urlopen("http:\example.com") to refresh the page every 5 minutes to collect the data I wanted. But I notice that I'm not getting the most recent content by doing this, it's different from what I see via browser su...

Django Celery AbortableTask usage

I'm trying to use the AbortableTask feature of Celery but the documentation example doesn't seem to be working for me. The example given is: from celery.contrib.abortable import AbortableTask def MyLongRunningTask(AbortableTask): def run(self, **kwargs): logger = self.get_logger(**kwargs) results = [] for ...

Making HTTP POST request

I'm trying to make a POST request to retrieve information about a book. Here is the code that returns HTTP code: 302, Moved import httplib, urllib params = urllib.urlencode({ 'isbn' : '9780131185838', 'catalogId' : '10001', 'schoolStoreId' : '15828', 'search' : 'Search' }) headers = {"Content-type": "application/x-ww...

When a Web framework isn't convenient to use ?

When a Web framework ( like django, ruby on rails, zend, etc ) isn't convenient to use ? And so... When a Web programming language ( like PHP, Asp, Python, etc ) is better than a Web Framework ? ...

Python Plugin-System - HOWTO

Hello, I'm writing a Python application which stores some data. For storing the data i've wrote a Connection class with abstract methods (using Python's abc module). This class is the super class all storage back-ends derive from. Each storage back-end has only one purpose, e.g. storing the data in plain text files or in a XML file. Al...

Problem decrypting PGP in python with pyme without user interaction

I am trying to decrypt messages using pyme (a python wrapper from gpgme). It works fine if I type in the password when it prompts but I cannot get the passphrase callback to work. Here is the code import pyme.core def Callback( x, y, z ): print 'in passphrase callback' return 'passphrase' plain = pyme.core.Data() cipher = pyme.co...

How to filter results getting from search using google API.

I am doing search using google api. I am using my base_url = http://ajax.googleapis.com/ajax/services/search/web I want to filter out some results according to need. How can i do that? ...

how to shift a datetime object by 12 hours in python

Datetime objects hurt my head for some reason. I am writing to figure out how to shift a date time object by 12 hours. I also need to know how to figure out if two date time object's differ by say 1 minute or more. ...

swig typemap for python: input and output arrays

I have a C function I want to use in Python: extern int convertAtoB( stateStruct *myStruct, const double PointA[3], double PointB[3]); Using SWIG, I think I need to define a typemap to convert the two points (PointA the input, PointB the output) so that Python can use it. There doesn't s...

Why is ruby not so popular in linux scripts comparing to python

Can you please explain me, why despite of great ruby popularity for web applications thanks to rails framework it is still not used or very rarely used by linux users to create system apps/scripts. We can compare it to python, witch not only has django and others for web applications, but is also commonly used as scripting language in li...