Python has two decorators @staticmethod and @classmethod. Could someone one explain the difference between the two or point me to a source where it is documented? When should the staticmethod decorator be used over the classmethod decorator?
...
Hello everyone,
I am new to programming and am learning Python as my first language. I have been tasked with writing a script that converts one input file type to another. My problem is this: There is one part of the input files where there can be any number of rows of data. I wrote a loop to determine how many rows there are but cannot...
I'm trying to create an image using matplotlib.pyplot.imshow(). However, when I run the program from my console, it doesn't display anything?
This is the code:
import matplotlib.pyplot
myimage = gen_image()
matplotlib.pyplot.gray()
matplotlib.pyplot.imshow(results)
But this shows nothing.
...
Having read some great things about the Django framework I'm becoming quite interested in it. But before making my decision to use it for a small project I would like to hear some more down to earth opinions: Please write of your experience with the framework beyond the usual "toy" website and how well it compares generally with other ma...
Using SUDS SOAP client how do I specify web service URL. I can see clearly that WSDL path is specified in Client constructor but what if I wan't to change web service url?
...
Hi,
I'm trying to write a python lib that will implement the client side of a certain chat protocol.
After i connect to the server i start the main loop where i read from the server and handle received commands and here i need to call a callback function (like on_message, or on file_received, etc).
How should i go about implementing this...
I'm trying to upload a huge file from my Nokia N95 mobile to my webserver using Pys60 python code. However the code crashes because I'm trying to load the file into memory and trying to post to a HTTP url. Any idea how to upload huge files > 120 MB to webserver using Pys60.
Following is the code I use to send the HTTP request.
f = ...
I have this folder structure:
package/
__init__.py
misc/
__init__.py
tools.py
subpackage/
__init__.py
submodule.py
I am in submodule.py, and I would like to import misc.tools. I don't want to use absolute import to import package.misc.tools, because then my package would only work when it's ...
I'm trying to download a corpus of news (to try to do some natural language processing) from Google News using the universal feedparser with python. I really know nothing of XML, I'm just using an example of how to use the feedparser.
The problem is that I can't find in the dict I get from the RSS feed the content of the news just the ti...
I'm learning Programming/Python from MIT OpenCourseware video lectures (link to the course), but the video quality is too low so I can't follow any of the code used in the lecture. Does anyone have (or can get, and upload) handouts provided for the course?
Many thanks
...
Hello,
I am after a library with a Python interface to render nice looking charts with hover events for each point.
ChartDirector does what I want, but I would prefer an open source solution.
OpenFlashChart looks good, although ideally I would want a non-Flash solution.
Any other contenders?
...
Example strings:
uji708
uhodih
utus29
agamu4
azi340
ekon62
I need to change them into CSV list like this:
uji708,uhodih,utus29,
agamu4,azi340,ekon62,
My code so far:
email = 'mail_list.txt'
handle = open(email)
for line in handle:
try:
email = line.split()[0].replace('\n', '')
l = line.split()
print ...
Here's the gist of what I'm trying to do. I have a list of objects, and I know they have an instance method that looks like:
def render(self, name, value, attrs)
# Renders a widget...
I want to (essentialy) decorate these functions at runtime, as I'm iterating over the list of objects. So that their render functions become this:
d...
When I'm trying to get the idle time of the gnome screensaver in seconds, through dbus, python throws an TypeError.
In the documentation I found for the screensaver sessionIdleTime, it returns a unsigned integer. http://www.gnome.org/~mccann/gnome-screensaver/docs/gnome-screensaver.html#gs-method-GetSessionIdle
However, when I'm in the...
Is there a package/library for python that would allow me to open a PDF, and search the text for certain words?
...
I create a simple form in Qt designer and am trying to load it in to a Qt application I'm creating with PySide but without much luck.
Here's the generated code from `pyside-uic':
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'clientEditorForm.ui'
#
# Created: Tue Nov 3 23:46:41 2009
# by: PySide ui...
I need to find out the maximum and minimum value in a line by reading a file and should be dividing the maximum value by the minimum value. Am interested to do this in python.
the contents of the file (file.txt) looks like this..
A28102_at,151,263,88,484,118,270,458,872,62,194
AB000114_at,72,21,20,61,20,85,20,25,20,65
AB000115_at,281,...
currently, if I make a page object of a pdf page with pyPdf, and extractText(), what happens is that lines are concatenated together. For example, if line 1 of the page says "hello" and line 2 says "world" the resulting text returned from extractText() is "helloworld" instead of "hello world." Does anyone know how to fix this, or have su...
hi
I want to add two variables to my subclass which is inherited from unittest.testcase
like I have:
import unittest
class mrp_repair_test_case(unittest.TestCase):
def __init__(self, a=None, b=None, methodName=['runTest']):
unittest.TestCase.__init__(self)
self.a= a
self.b = b
def t...
Hello,
I would like to generate a graphical sitemap for my website. There are two stages, as far as I can tell:
crawl the website and analyse the link relationship to extract the tree structure
generate a visually pleasing render of the tree
Does anyone have advice or experience with achieving this, or know of existing work I can ...