Hi, I have a gzip file and I am trying to read it via python as below:
import zlib
do = zlib.decompressobj(16+zlib.MAX_WBITS)
fh = open('abc.gz', 'rb')
cdata = fh.read()
fh.close()
data = do.decompress(cdata)
it throws :
zlib.error: Error -3 while decompressing: incorrect header check
How can I overcome it.
...
I have a comma separated value table that I want to read in Python. What I need to do is first tell Python not to skip the first row because that contains the headers. Then I need to tell it to read in the data as a list and not a string because I need to build an array out of the data and the first column is non-integer (row headers)....
I'm writing a python script to read through a list of domains, find out what rating Mcafee's Siteadvisor service gives, then output the domain and result to a CSV.
I've based my script off this previous answer. It uses the urllib to scrape Siteadvisor's page for the domain in question (not the best method, I know, but Siteadvisor provid...
I have this code:
db.query(sets, stores).select_from(orm.join(sets, stores,\
sets.store_scheme_id == stores.store_id)).filter(sets.id == id).one()
And I have the SQL debugging level at DEBUG, so it prints out the generated SQL query before it returns. The generated SQL works fine in phpmyadmin. SQLAlchemy, however, DOESN'T work fine a...
I've been working with a few RAD gui builders lately. I absolutely despise CSS ( camel is a horse designed by committee etc.) What algorithms are used by packing managers(java/tk). Most GUI toolkits I've used have some alternative to absolute positioning, sorry for the ambiguity but how do you start thinking about implementing a packing...
Well, I have made a module that allows you to copy a file to a directory easier. Now, I also have some "try's" and "except's" in there to make sure it doesn't fail in the big messy way and doesn't close the terminal, but I also want it to display different error messages when a wrong string or variable is put in, and end the module, but ...
Hey,
i got a n00b problem with python and i've been searching here for a while and i couldnt find a proper solution...
i got a utf8 form that i ajax post to a python page. i read the json simplejson with utf-8 charset.
the text is fine as long as there is no mixed utf8 and latin chars like ?!;, etc...
UnicodeDecodeError: 'ascii' codec...
Is it possible to see files with certain extensions with the os.listdir command? I want it to work so it may show only files or folders with .f at the end. I checked the documentation, and found nothing, so don't ask.
...
I am looking for using Python as PDF Editing and Processing Framework.
Any suggestions? looking for an open source and well maintained library
...
Both Google and the online docs are not delivering much insight on my query, so I thought I would ask the community here.
In Perl, you can easily setup a hash-of-a-hash-of-a-hash and test the final key like so:
my $hash = {};
$hash{"element1"}{"sub1"}{"subsub1"} = "value1";
if (exists($hash{"element1"}{"sub1"}{"subsub1"})) {
print "...
Today one peculiar thing happened to me .I was trying to get a hang of appengine and djago on www.shell.appspot.com
when i entered
dir(django)
the o/p i got was
['VERSION', '__builtins__', '__doc__', '__file__', '__name__', '__path__', 'conf', 'core', 'template', 'utils']
but still i tried
from django import forms
and it wo...
I'm trying to parse an html form using mechanize. The form itself has an arbitrary number of hidden fields and the field names and id's are randomly generated so I have no obvious way to directly select them. Clearly using a name or id is out, and due to the random number of hidden fields I cannot select them based on the sequence number...
I have Google App SDK on Mac OSX 1.4.11, all python environment are OK. I try to upload data from manually generated .csv using appcfg.py. When upload directly to Google appspot.com all succeed.
Just to perform upload data locally it fail for authentication reason as generated below:
Application: myapplication; version: 1.
Uploading dat...
I'm in that horrible questioning state. No, not trying to figure out if I'm gay. I'm trying to decide between Django and Rails.
From what I've read, Django probably fits my needs better, both from a "cultural" and goal point of view. The baked-in admin interface pretty much sells me alone. However, I have one critical concern: it look...
i am trying to write a quiz system to learn django where users can add quizes to the system.
my models look like
from google.appengine.ext import db
class Quiz(db.Model):
title=db.StringProperty(required=True)
created_by=db.UserProperty()
date_created=db.DateTimeProperty(auto_now_add=True)
class Question(db.Model):
question=db....
I'm planning some Symbian related development on S60 3.1 platform. It seems like generally available language options are Python and C++. However Nokia's official forum seems very much tilted towards C++.
I want to know what are the advantages and disadvantages of using Python for S60 over Symbian C++? And is it even possible to do Pyth...
I have to convert a given 16 bit integer into two 8 bit integers, which are then taken and used as output, where they are headed takes the two 8 bit integers and recombines them as 16 bit input (unfortunately out of my control). My solution works, but feels unclean. For the coarse number I am bit shifting the original number, and for t...
Hello guys! This is my first question.
My python script opens and reads from a present text file using the following simple funct:
open("config.ini", "r")
As this is a relative path it is supposed to work because config.ini is placed in the same directory like the script is when it is launched, that should be the current working dir....
Well, my question is a little complicated, but here goes:
I have a Python server that stores client (written in JavaScript) sessions, and has complete knowledge of what the client currently has stored in its state.
The server will constantly fetch data from the database and check for any changes against the client state. The data is JS...
I'm developing an app (an API) in python and I would like to offer some of its functionality through a web interface (like web services do).
I've been looking at django, but I don't know if really fits well in my idea. I only want to create a web page that invokes to my API methods in order to acomplish the functionality that offers th...