I'd like to use Python for develop an app in Android using ASE. My problem is I'm thinking about adding a UI to it but don't know how.
Where can I find some documentation or help?
I am running a website on CentOS 5.3. I understand centos will break if the default python 2.4 is upgraded. I followed this site (http://www.question-defense.com/2009/12/25/how-to-install-python-2-6-on-centos-5-without-breaking-yum) and got python 2.6 installed.
Now if I run "python" it runs python2.4 and if I run "python26" it runs python2.6.
I am trying to compile mod_wsgi-3.2. When it run ./configure it takes only python 2.4 environment. I have tried using the --with-python=/usr/bin/python26. That way, "make" command does not work.
Can someone throw some light on this?
Thanks in advance
How can I make a python loop run at a set rate regardless of how long it takes to execute commands in the loop (providing the commands take less time to run than the loop is allowed)?
How can I make this run every 0.25 seconds, for example?
while True:
print("OK")
Hello,
I'm using windows 7 english and I want to know how to see the microsoft speech language and to see if the speech recognition is active.
How can I do it using python?
Does python compile down to some byte code or is it rendered on the fly each time like php/asp?
From my readings I read it has its own byte code format, so i figured it was like java/.net where it compiles into a intermediate language/byte code.
so it is more effecient in that respect that php right?
Hello, newbie here.
i have a local Postgre database which will be filled with data (daily) on my local development machine. What is a good solution to transfer/sync/mirror this data to a production postgre database.
For what it's worth I'm developing in Python using Dajngo.
Thanks!
I am currently processing text/html data and I wish to store my results in some sort of database. My current setup is Pydev with Eclipse.
What is the best database to use with my current development environment?
What is the best python library to use with the suggested database?
Are there any guidelines to writing Google App Engine Python code that would work without Google's infrastructure on other platforms?
Is there any known attempt to create an open source framework which can run applications designed for Google App Engine on other platforms?
Edit:
To clarify, the question really is:
If I develop an application on Google App Engine now, will I be able to migrate to another platform later, or is it a lock in?
How can I find the dimensions of a matrix in Python. Len(A) returns only one variable.
Edit:
Hi Thanks.
close = dataobj.get_data(timestamps, symbols, closefield)
Is (I assume) generating a matrix of integers (less likely strings). I need to find the size of that matrix, so I can run some tests without having to iterate through all of the elements. As far as the data type goes, I assume it's an array of arrays (or list of lists).
Why in this millenium should Python PEP-8 specify a maximum line length of 79 characters?
Pretty much every code editor under the sun can handle longer lines. What to do with wrapping should be the choice of the content consumer, not the responsibility of the content creator.
Are there any (legitimately) good reasons for adhering to 79 characters in this age?
I want to create a class that doesn't gives an Attribute Error on call of any method that may or may not exists:
My class:
class magic_class:
...
# How to over-ride method calls
...
Expected Output:
ob = magic_class()
ob.unknown_method()
# Prints 'unknown_method' was called
ob.unknown_method2()
# Prints 'unknown_method2' was called
Now, unknown_method and unknown_method2 doesn't actually exists in the class, but how can we intercept the method call in python ?
I need to convert a compiled python code (.pyo) to its source . I look in depython.net, but there is a problem. A warning;
"File version older than 2.4."
What should I do?
Thanks.
Consider a Python list my_list containing ['foo', 'foo', 'bar'].
What is the most Pythonic way to uniqify:ing and sorting and the list (think cat my_list | sort | uniq)?
This is how I currently do it and while it works I'm sure there are better ways to do it.
my_list = []
...
my_list.append("foo")
my_list.append("foo")
my_list.append("bar")
...
my_list = set(my_list)
my_list = list(my_list)
my_list.sort()
I would like to use Python's tempfile module to create a temporary file that I will use for communication between processes (use of pipes is awkward).
The documentation I've linked to above shows two functions that almost do what I want:
tempfile.NamedTemporaryFile # For creating named tempfiles
tempfile.SpooledTemporaryFile # For creating tempfiles in memory
but actually I want a tempfile that is both named AND in memory. Any ideas?
The question is how to write a program that measures how many times a character appears in a string in a generalizable way in python.
The code that I wrote:
def countLetters(str, ch):
count=0
index=0
for ch in str:
if ch==str[index]:
count=count+1
index=index+1
print count
when I use this function, it measures the length of the string instead of how many times the character occurs in the string. What did I do wrong? What is the right way to write this code?
I've got thousands of urls from many hosts I need to screenshot.
I can use the lib fine from the command line, but how can I integrate it into my code so I can take multiple screenshots simultaneously?
I think it's something to do with xvfb as with the answer to this question: http://stackoverflow.com/questions/1747022/how-to-kill-headless-x-server-started-via-python but I'm not sure what exactly.
Hi,
i would like to replace the lines
function *{
by
function *{echo "The function starts here."
where * is what ever.
Any idea how to do that in Python?
Regards
Javi
I find myself adding debugging "print" statements quite often -- stuff like this:
print("a_variable_name: %s" % a_variable_name)
How do you all do that? Am I being neurotic in trying to find a way to optimize this? I may be working on a function and put in a half-dozen or so of those lines, figure out why it's not working, and then cut them out again.
Have you developed an efficient way of doing that?
I'm coding Python in Emacs.
I remember when I was developing in C++ or Java, the compiler usually complains for unused methods, functions or imports. In my Django project, I have a bunch of Python files which have gone through a number of iterations. Some of those files have a few lines of import statement at the top of the page and some of those imports are not used anymore. Is there a way to locate those unused imports besides eyeballing each one of them in each file?
All my imports are explicit, I don't usually write from blah import *
I see what seems like a majority of Python developers on StackOverflow endorsing the use of concise functional tools like lambdas, maps, filters, etc., while others say their code is clearer and more maintainable by not using them. What is your preference?
Also, if you are a die-hard functional programmer or hardcore into OO, what other specific programming practices do you use that you think are best for your style?
Thanks in advance for your opinions!
Do you know any easy way to find a logging call that throws "not enough argumenst for format string".
On my workstation I've modified logging/__init__.py to print the msg so I can easily find the line in the source.
But do you have any idea what to do on the testing environment where you can't change python standard library nor run pdb easily?
A project that involves image processing, i.e. to calculate the angular shift of the same image when shifted by a medium of certain Refractive Index. We have to build an app that correlates the 2 images (phase/2D correlation?) and then plot using Chaco and Mayavi (2 libraries in Python).
Is there any other existing template software (FOSS) that we can base our app on, or use it as a reference?