python

How to get _sqlite3.so file?

I have installed Python 2.6.2.. I did it "locally" since I do not have root permissions. With this version of Python I wanted to use module called "sqlite3" (it is called "pysqlite" in earlier versions). In theory I had to be able to use this module without any problems since it is supposed to be included by default in the considered ve...

is there anyway to use TestCase.assertEqual() outside of a TestCase?

I have a utility class that stores methods that are useful for some unit test cases. I want these helper methods to be able to do asserts/fails/etc., but it seems I can't use those methods because they expect TestCase as their first argument ... I want to be able to store the common methods outside of the testcase code and continue to u...

Python: Grab the A record of any URI?

I basically want to implement something where you can type in any URI ( I probably will only deal with http ) and I want to return the A record of the domain in the URI, I want the server's IP address. I know there's the ping command which most people use to look an ip address up, but I also know there's 'host' and 'dig' which are more...

Cleanest way to define classes in Python?

I want to define classes in Python, but I'm currently putting them in modules, contained within packages. Is there a cleaner way of doing this? Is it okay to define classes in __init__.py of the package itself? I'm still learning how to arrange my Python source code, but this seems to be creating a slight ambiguity? Thanks to all! ...

how to submit query to .aspx page in python

I need to scrape query results from an .aspx web page. http://legistar.council.nyc.gov/Legislation.aspx The url is static, so how do I submit a query to this page and get the results? Assume we need to select "all years" and "all types" from the respective dropdown menus. Somebody out there must know how to do this. ...

Efficient method to determine location on a grid(array)

I am representing a grid with a 2D list in python. I would like to pick a point (x,y) in the list and determine it's location...right edge, top left corner, somewhere in the middle... Currently I am checking like so: # left column, not a corner if x == 0 and y != 0 and y != self.dim_y - 1: pass ...

Most used Python module for video processing ?

I need to: Open a video file Iterate over the frames of the file as images Do some analysis in this image frame of the video Draw in this image of the video Create a new video with these changes OpenCV isn't working for my webcam, but python-gst is working. Is this possible using python-gst? Thank you! ...

phpMyAdmin equivalent in python?

Is there a python equivalent of phpMyAdmin? ...

Python interpreter as a c++ class

I am working on embedding python in to c++. In some peculiar case I require two separate instances of the interpreter in same thread. Can I wrap Python interpreter in to a c++ class and get services from two or more class instances? ...

How i can, on some global keystroke, paste some text to current active application in linux with Python or C++

I want to write app, which will work like a daemon and on some global keystroke paste some text to current active application (text editor, browser, jabber client) I think i will need to use some low level xserver api. How i can do this with Python or C++ ? ...

Socket program Python vs C++ (Winsock)..

I have python program which works perfectly for internet chatting. But program built on similar sockets in C++ do not work over internet. Python program import thread import socket class p2p: def __init__(self): socket.setdefaulttimeout(50) self.port = 3000 #Destination IP HERE self.peerId = '59.95.18.156' ...

pythonic format for indices

Hello, I am after a string format to efficiently represent a set of indices. For example "1-3,6,8-10,16" would produce [1,2,3,6,8,9,10,16] Ideally I would also be able to represent infinite sequences. Is there an existing standard way of doing this? Or a good library? Or can you propose your own format? thanks! Edit: Wow! - thank...

How can I make Python see sqlite?

I cannot use sqlite3 (build python package). The reason of that is missing _sqlite3.so file. I found that peoples had the same problem and they resolved it here. To solve my problem I have to "install sqlite3 and recompile Python". I also found out that the problem can be solved by "building from source and moving the library to /usr/lib...

Python - Same line of code only works the second time it called?

Sorry I couldn't really describe my problem much better in the title. I am trying to learn Python, and came across this strange behavior and was hoping someone could explain this to me. I am running Ubuntu 8.10 and python 2.5.2 First I import xml.dom Then I create an instance of a minidom (using its fully qaulified name xml.dom.minido...

how to configure apache on XP for python 2.6.2 and what do you prefer, python with framework/without?

I am starting python today. It will be my pleasure to have your help. ...

How to add header while making soap request using soappy

I have WSDL file, using that i wanted to make soap request which will look exactly like this -- <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt; <soap:Header> <AuthSoapH...

set URL when enter site - pylons

Hey My problem is that when a user enter my website like: www.mywebsite.com I use pylonshq I want the URL to be change to /#home if its possible via. map.connect. I have no idéa how to fix it via. python, so therefore a guide or maybe some samples would be a help. Right now it looks like this: map.connect('/', controller='home',a...

Python urllib2 HTTPS and proxy NTLM authentication

Hello, urllib2 doesn't seem to support HTTPS with proxy authentication in general, even less with NTLM authentication. Anyone knows if there is a patch somewhere for HTTPS on proxy with NTLM authentication. Regards, Laurent ...

How to call the __del__ method?

I am reading a code. There is a class in which __del__ method is defined. I figured out that this method is used to destroy an instance of the class. However, I cannot find a place where this method is used. The main reason for that is that I do not know how this method is used, probably not like that: obj1.del(). So, my questions is how...

Python: This should be impossible, shouldn't it?

This is part of my Django application which is saving a user's profile in a special way. class SomeUser: def __init__(self, request): self.logged_in = True self.profile = request.user.get_profile() self.favorites = self.profile.favorites.all().values_list('pk', flat=True) def save(self, resp): p...