python

Getting group names your contacts belong to using the gdata module

Hello I am trying to find out how to get the title of groups the contact belongs to. This is how I am getting my other contact information: query = gdata.contacts.service.ContactsQuery() query['showdeleted'] = 'true' query.updated_min = str(lastKnownTime) query.max_results = 5000 feed = gd_client.GetContactsFeed(query.ToUri()) insertCo...

How to upload pdf and pptx files to google docs via the gdata python client?

Hi there, world I'm using the gdata python client for the google docs api for a project. I use oauth authentication and all the dance, and have successfully uploaded .doc, .xls and every file type in Their FAQ. but I cannot seem to upload pdf files, even though is right there, listed on the supported filetypes. I tried with the latest ...

remove everything between 2 tags that span branches of an xml tree.

I'm trying to remove everything in an XML Document between 2 tags, using python & lxml. the problem is that the tags can be in different branches of the tree (but always at the same depth) an example document might look like this. <root> <p> Hello world <start />this is a paragraph </p> <p> Goodbye world. <end />I'm leaving now...

which is the best django blog .

i want to find a blog system for my site , which is best ,easy to Customize. thanks ...

Hyperlink In Tkinter Text Widget?

I am re designing a portion of my current software project, and want to use hyperlinks instead of buttons. I really didn't want to use a Text widget, but that is all I could find when I Googled the subject. Anyway, I found an example of this, but keep getting this error: TclError: bitmap "blue" not defined when I add this line of cod...

Permanently add a directory to PYTHONPATH

Whenever I use sys.path.append, the new directory will be added. However, once I close python, the list will revert to the previous (default?) values. How do I permanently add a directory to PYTHONPATH? Using Windows. ...

best way to download large files with python

Which library/module is the best to use for downloading large 500mb+ files in terms of speed, memory, cpu? I was also contemplating using pycurl. ...

python dict remove duplicate values by key's value?

A dict dic = { 1: 'a', 2: 'a', 3: 'b', 4: 'a', 5: 'c', 6: 'd', 7: 'd', 8: 'a', 9: 'a'} I want to remove duplicate values just keep one K/V pair, Regarding the "key" selection of those duplicated values, it may be max or min or by random select one of those duplicated item's key. I do not want to use a k/v swap since ...

How to reverse django feed url?

I've been searching for hours to try and figure this out, and it seems like no one has ever put an example online - I've just created a Django 1.2 rss feed view object and attached it to a url. When I visit the url, everything works great, so I know my implementation of the feed class is OK. The hitch is, I can't figure out how to link ...

Controlling a C# Winforms GUI with IronPython

So I made a Winforms GUI in Visual Studio using C#, but for the project I am working on I want the majority of the code to be written in Python. I am hoping to have the "engine" written in python (for portability), and then have the application interface be something I can swap out. I made the C# project compile to a .dll, and was able ...

Is there a way to force lxml to parse Unicode strings that specify an encoding in a tag?

I have an XML file that specifies an encoding, and I use UnicodeDammit to convert it to unicode (for reasons of storage, I can't store it as a string). I later pass it to lxml but it refuses to ignore the encoding specified in the file and parse it as Unicode, and it raises an exception. How can I force lxml to parse the document? This ...

Find max length word from arbitrary letters

I have 10 arbitrary letters and need to check the max length match from words file I started to learn RE just some time ago, and can't seem to find suitable pattern first idea that came was using set: [10 chars] but it also repeats included chars and I don't know how to avoid that I stared to learn Python recently but before RE and ...

Approaches to embedded vector images/charts into PDF

How have people from the Linux world embedded vector images into PDF? I am attempting to create automated reports from data that I currently render as SVG images. Ideally, I would like to use the same XML in PostScript, PDF or DjVu format. To what degree are those formats able to handle SVG natively? More broadly, what have people's ex...

Fibonacci sequence

Possible Duplicate: How to write the Fibonacci Sequence in Python Hi. I'm also a learning programmer and I've been asked the same question you were asked for Fibonacci numbers and I can't figure it out. Can you please show me the code you used to generate these numbers asking the user to give numbers and find only the numbers ...

id() function in python

id(object) This is an integer (or long integer) which is guaranteed to be unique and constant for this object during its lifetime. Can you explain this output? Why does j's id change? >>> i=10 >>> id(i) 6337824 >>> j=10 >>> id(j) 6337824 >>> j=j+1 >>> id(j) 6337800 >>> id(i) 6337824 ...

Twisted Web Proxy

Found the Answer. In Firefox set the proxy ip address not to localhost or 127.0.0.1 but instead set it as the 192.168.x.x or the 10.10.x.x to find this open cmd and type ipconfig /all (windows) or on linux ifconfig and find out what your ip address is. I have been running this code (from: http://blog.somethingaboutcode.com/?p=155 ): ...

Django urls straight to html template.

Hi Learning django & python. Just set up a new site after doing the tutorial. Now for arguments sake say I want to add a bunch of About us, FAQ basic html pages with very limited dynamic elements do you go ahead and write a new line in my urls.py file for each page? or is their some neat way to say map all * *.html to the relevant .htm...

Creating Instances of IronPython Classes From C#

I want to create an instance of an IronPython class from C#, but my current attempts all seem to have failed. This is my current code: ConstructorInfo[] ci = type.GetConstructors(); foreach (ConstructorInfo t in from t in ci where t.GetParameters().Length == 1 select t) { ...

Django installation problem on Windows

Hi, I am trying to install Django on Windows XP. Here is what I did: (1) Downloaded and installed Python 2.7 from http://python.org/ftp/python/2.7/python-2.7.msi in C:\Python27 (2) Downloaded Django 1.2.1 from http://www.djangoproject.com/download/1.2.1/tarball/ (3). After unzipping the file I placed Django's folder ...

need to selectively escape html entities (&)

I'm scraping a html page, then using xml.dom.minidom.parseString() to create a dom object. however, the html page has a '&'. I can use cgi.escape to convert this into &amp; but it also converts all my html <> tags into &lt;&gt; which makes parseString() unhappy. how do i go about this? i would rather not just hack it and straight rep...