python

python Qt: main widget scroll bar

Hello Everybody, We are trying to put scrollbar on the main widget, so if the user resizes the main window, the scrollbar appears, and let he move up and down to see child widgets that is outside the smaller window widget, allowing it to move right and left. Here is the code for the main widget with the scroll-bar.. def centralWDG(sel...

Adding a string in front of a string for each item in a list in python

I have a list of websites in a string and I was doing a for loop to add "http" in the front if the first index is not "h" but when I return it, the list did not change. n is my list of websites h is "http" for p in n: if p[0]!="h": p= h+ p else: continue return n when i return the list, it returns my original...

How to get IUnknown from WDM driver CreateInstance

In documentation (C++ example) LUnknown* pIUnknown = CreateInstance(slot); I try this >> import ctypes >> print type(ctypes.cdll.lcomp.CreateInstance(0)) <type 'int'> How to get IUNKNOWN and QueryInterface? ...

How to build standalone python installation

How can I build python interpreter which can be installed by just extracting the archive? e.g. I want to python-2.6.tag.gz. User will extract it in any directory, and start using it. ...

sqlite python insert

I have asked similar question before , here is detailed explanation of what i'm trying to achieve I have two sqlite tables table1 - is standard table - has fields like server,id,status table2 - has fields like server,id,status,number,logfile Table2 is empty and Table1 has values. I'm trying to fill table2 with entries from table1. I ...

Python Qt: embedded html bug?

Hi Everybody, Here is a strange thing that is happening... I have used embedded html with Qt Python to display a form inside the GUI/Widget. The problem is, if the cell has more content, it shows a black shadow like a box on the right side of that cell/table. Here is an example of the code working fine: html += ("<BR><BR><table bo...

Qt: Python tcp client sends data over socket. How to read these bytes with Qt ?

Situation: I have tcp client made with Python and tcp server made with Qt. I try to send bytes with my client but I can't get Qt server to read these bytes. Using Python made client and server, everything works fine. Also I can get my Python client work with C# server with no problems. Code for Python client: import socket import sys...

Persisting hashlib state

I'd like to create a hashlib instance, update() it, then persist its state in some way. Later, I'd like to recreate the object using this state data, and continue to update() it. Finally, I'd like to get the hexdigest() o the total cumulative run of data. State persistence has to survive across multiple runs. Example: import hashlib m ...

Python Qt: Qprinter not defined

Hi Everybody, I am trying to put the printer to run the output from an html document. Here is a small function to do that: def callPrinterHtml(self,document): self.printer = QPrinter() self.printer.setPageSize(QPrinter.Letter) dialog = QPrintDialog(self.printer, self) if dialog.exec_(): document.print_(self.pr...

Google App Engine (python) authorization web services /third party client

I have a google app engine project and i want to make my REST API available to third parties. Like twitter API. Twitter requests the user and password to be sent so thet they can be authorized - can i do this with google user accounts? I have read somewhere on this site this is not a prefered method as their credentials are entered in...

No plot window in matplotlib

I just installed matplotlib in Ubuntu 9.10 using the synaptic package system. However, when I try the following simple example >>> from pylab import plot; >>> plot([1,2,3],[1,2,3]) [<matplotlib.lines.Line2D object at 0x9aa78ec>] I get no plot window. Any ideas on how to get the plot window to show? ...

How can I convert a digraph to an undirected graph in networkx?

I am using the networkx package. Is there a function in networkx which can do the task for me? ...

Preprocess SHPAML in Django's template loader?

Is there any way to make Django's template loader run all templates it loads (i.e. directly or via extend/include) through SHPAML if it figures the HTML is out of date? I know how to invoke SHPAML recursively over an entire directory, but I would prefer to be able to run it on demand so I don't have to remember to sync the HTML every ti...

Moving from PHP to Python

Currently I do all of my web-based programming in PHP, and each day I get more and more anxious to try Python. Not that I haven't played with it in an interpreter, but I mean really, write a web-based project in Python, and possibly move pretty much exclusively over to Python. But, I know that Python isn't strictly a web-based programm...

Creating a mock web service from a WSDL file in Python

Hi, We are writing a client for a remote service that exposes SOAP web services and publishes a WSDL definition for those services. We don't have access to the system during testing, so we'd like to write a mock service. We're using Python for the client, so ideally we'd want to use Python for the mock server, although I suppose it's ...

How can I normalize/collapse paths or URLs in Python in OS independent way?

I tried to use os.normpath in order to convert http://example.com/a/b/c/../ to http://example.com/a/b/ but it doesn't work on Windows because it does convert the slash to backslash. ...

Using Python like PHP in Apache/Windows

I understand that I should use mod_wsgi to run Python, and I have been trying to get that set up, but I'm confused about it: This is a sample configuration I found for web.py: LoadModule wsgi_module modules/mod_wsgi.so WSGIScriptAlias /appname /var/www/webpy-app/code.py/ Alias /appname/static /var/www/webpy-app/static/ AddType text/h...

Alternative ways to browse the python api

Is it just me, or the python standard library documentation is extremely difficult to browse through? http://docs.python.org/3.1/library/index.html http://docs.python.org/3.1/modindex.html Java has its brilliant Javadocs, Ruby has its helpful Ruby-Docs, only in python I cannot find a good way to navigate through the standard library ...

Django-registration, force unique e-mail

Can I force users to make unique e-mail addresses in django-registration? ...

Django and SSL question

Hello, I am planning to sell products by charging credit cards thus using SSL will be critical for Django-powered website. And I am very naive for this. My initial django setup plan was using Apache as the webserver and using mod_wsgi to communicate with Django, static media again served by Apache. All seemed good until SSL protocol com...