python

libxml2 install error: command 'gcc' failed with exit status 1? What are the dependencies of libxml2?

Hi everybody!! I am trying to install libxml2 on unbuntu 9.10 and getting errors: $ sudo python setup.py develop Its a very lengthy error message but the last error is Setup script exited with error: Command 'gcc' failed with exit status 1. Can anybody tell me why i am getting this error? What are the dependencies or libraries requi...

Python | change text color in shell

I was wondering if anyone knows how to set the color of the text that shows up in the shell. I noticed the 'ls' uses a couple different colors when printing out information to the screen (on my Linux box), was wondering if I could take advantage of that in Python. ...

Keeping ORM with stored procedures

Hello, I am developing a Python web app using sqlalchemy to communicate with mysql database. So far I have mostly been using sqlalchemy's ORM layer to speak with the database. The greatest benefit to me of ORM has been the speed of development, not having to write all these sql queries and then map them to models. Recently, however, I'...

In Python with sqlite is it necessary to close a cursor?

Here is the scenario. In your function you're executing statements using a cursor, but one of them fails and an exception is thrown. Your program exits out of the function before closing the cursor it was working with. Will the cursor float around taking up space? Do I have to close the cursor? Additionally, the Python documentation...

Python LinkedIn API problem (OAuth)

Hi everyone, has anyone used the pylinkedin library ? After redirection from LinkedIn when I try to get the accessToken LinkedIn returns oauth_problem=permission_unknown Any clues ...

How to set the program title in python

Hi, I have been building a large python program for a while, and would like to know how I would go about setting the title of the program? On a mac the title of program, which has focus, is shown in the top left corner of the screen, next the the apple menu. Currently this only shows the word "Python", but I would of course like to my p...

Why am I getting this error in Django (I'm trying to do a 304 not modified)

def list_ajax(reqest): #q = request.GET.get('q',None) #get all where var = q. return ... list_ajax = condition(etag_func=list_ajax)(list_ajax) As you can see, I'm trying to return a 304 to the client if the result is the same. But, I am getting this Django error, why?: Traceback: File "/usr/local/lib/python2.6/dist-package...

Echo Program in between Arduino and Python

I want to send some data to an Arduino through pyserial in Python. All I want to the Arduino to do is read the variable length string data from the serial port, and write it back so that Python can read it. Since I've been unable to do that, the code below only has Python sending on character. Here's the Python code: import serial impor...

Is there such a thing as "too many yield statements" in python?

If doing a directory listing and reading the files within, at what point does the performance of yield start to deteriorate, compared to returning a list of all the files in the directory? Here I'm assuming one has enough RAM to return the (potentially huge) list. PS I'm having problems inlining code in a comment, so I'll put some exam...

How to convert ctypes' c_long to Python's int?

int(c_long(1)) doesn't work. ...

Colorize PyLint Output?

Anyone have any tricks/techniques for colorizing PyLint output? ...

Getting fast translation of string data transmitted via a socket into objects in Python

I currently have a Python application where newline-terminated ASCII strings are being transmitted to me via a TCP/IP socket. I have a high data rate of these strings and I need to parse them as quickly as possible. Currently, the strings are being transmitted as CSV and if the data rate is high enough, my Python application starts to ...

which is the best way to get the value of 'session_key','uid','expires'....

i have a string ''' {"session_key":"3.KbRiifBOxY_0ouPag6__.3600.1267063200-16423986","uid":164 23386,"expires":12673200,"secret":"sm7WM_rRtjzXeOT_jDoQ__","sig":"6a6aeb66 64a1679bbeed4282154b35"} ''' how to get the value . thanks ...

Why am I getting no attribute '__getitem__' error for dictionary?

Why am I getting no attribute __getitem__ error for dictionary: Traceback (most recent call last): File "./thumbnail.py", line 39, in <module> main() File "./thumbnail.py", line 19, in main options['input_pattern'] AttributeError: Values instance has no attribute '__getitem__' Here's the code: #!/usr/bin/env python impor...

how do i login facebook via facevook connect and django.

my request.__dict__ is : ['session', 'openid', '_post_parse_error', 'openids', '_cached_user', '_files', 'facebook', '_post', '_get', 'META', 'environ', 'path_info', 'LANGUAGE_CODE', 'path', '_cookies', 'method'] my request.facebook is : ['feed', 'status', 'marketplace', 'uid', 'stream', 'locale', 'auth_token', 'is_session_from...

piping output of subprocess.Popen to files

I need to launch a number of long-running processes with subprocess.Popen, and would like to have the stdout and stderr from each automatically piped to separate log files. Each process will run simultaneously for several minutes, and I want two log files (stdout and stderr) PER process to be written to as the processes run. Do I need t...

datetime.datetime.utcnow() why no tzinfo?

datetime.datetime.utcnow() datetime.datetime(2010, 2, 25, 4, 14, 37, 366086) Why does this datetime not have any tz info say its a utc date. ...

How to set a icon file while creating file

Hi All, I am creating a tar file ( from several files), now while saving this tar file i save this file as my particular extension like (.xyz), so i want whenever i save this type file (.xyz extension) from my tool this file should save with a particular ico file format. This is similar like when we save a bmp or jpeg file from mspaint ...

A user management system for a new app?

im using python. is there a widely accepted way of doing it? it deals with some data management things, so i dont want to implement it like in stackoverflow, with anonymous accounts. i also don't want to roll my own system from scratch. any recommendations? ...

Android app uploading data to a python server via post

I have successfully implemented this from android to a java httpservlet on google app engine, but I'd like to use python instead for the server side. I'm new to python. Has anyone done this? I have the guestbook example up and running, but I can't seem to send posts from my android app to the server. I'd also like to issue a string res...