I have installed couchDB v 0.10.0, and am attempting to talk to it via python from Couch class downloaded from couchDB wiki. Problem is:
Create database 'mydb': {'error': 'unauthorized', 'reason': 'You are not a server admin.'}
I hand edited the local.ini file to include my standard osx login and password. I now have full access via f...
I need to visualize spatial data (20 polygons) from "postgis" database (postgresql), with python. I know how to connect postgresql database with python only, but I don`t how to visualize those polygons. It is project for my university. We need to use for example matplotlib and create application in python which will visualize shapefiles ...
Here is my guess, which doesn't work:
class BaseClass(object):
def foo(self):
return 'foo'
def bar(self):
return 'bar'
def methods_implemented(self):
"""This doesn't work..."""
overriden = []
for method in ('foo', 'bar'):
this_method = getattr(self, method)
base...
What programming language has short and beautiful grammars (in EBNF)?
Some languages are easer to be parsed. Some time ago I have created a simple VHDL parser, but it was very slow. Not because it is implemented completely in Python, but because VHDL grammar (in EBNF) is huge. The EBNF of Python is beautiful but it is not very short.
I...
Gmail has this sweet thing going on to get an atom feed:
def gmail_url(user, pwd):
return "https://"+str(user)+":"+str(pwd)+"@gmail.google.com/gmail/feed/atom"
Now when you do this in a browser, it authenticates and forwards you. But in Python, at least what I'm trying, isn't working right.
url = gmail_url(settings.USER, setting...
Can you delete emails with imaplib? If so how?
...
My application is assumed to be running on a Mac OS X system. However, what I need to do is figure out what version of Mac OS (or Darwin) it is running on, preferably as a number. For instance,
"10.4.11" would return either 10.4 or 8
"10.5.4" would return 10.5 or 9
"10.6" would return 10.6 or 10
I found out that you could do this, ...
I want to create a field for phone number input that has 2 text fields (size 3, 3, and 4 respectively) with the common "(" ")" "-" delimiters. Below is my code for the field and the widget, I'm getting the following error when trying to iterate the fields in my form during initial rendering (it happens when the for loop gets to my phone...
I am trying to extract the first words in a file by Python.
My code
import re
con1 = pg.DB('tk', 'localhost', 5432, None, None, 'masi', '123')
f1="/home/masi/fy.txt"
print re.findall(r"\w+", f1.read())
I get the error
Traceback (most recent call last):
File "<stdin>",...
One of my Python scripts runs in interactive mode but fails when run from the command line. The difference is that when run from the command line, it imports modules from a bad .egg file, and when run interactively it uses my fixed (unzipped) version in the current directory.
My question is two-fold: a) why does Python load modules diff...
Hi all!
After one of my last questions about python&c++ integration i was told to use dlls at windows.
(Previous question)
That worked ok doing:
cl /LD A.cpp B.cpp C.pp
in windows enviroment, after setting the include path for boost, cryptopp sources and cryptopp libraries.
Now i'm tryting to do the same in linux, creating a .so fil...
Is there any tool available to automatically convert Python 2.x scripts to Python 3.x? Or do you still have to convert it manually? 2.x-3.x auto-converter would be really helpful (to everyone else too, I guess).
Ofcourse I'm not looking to convert large programs, just about 8-10 modules.
Thanks
...
I'm unable to test-run a cssparser that I'd like to use.
test.py:
from css.parse import parse
data = """
em {
padding: 2px;
margin: 1em;
border-width: medium;
border-style: dashed;
line-height: 2.4em;
}
p { color: red; font-size: 12pt }
p:first-letter { color: green; font-size: 200% }
p:first-l...
I am trying to rewrite the following program in C instead of C# (which is less portable). It is obvious that "int system ( const char * command )" will be necessary to complete the program. Starting it with "int main ( int argc, char * argv[] )" will allow getting the command-line arguments, but there is still a problem that is difficult...
I've tried to do it like they describe in the AppEngine docs but I can't get it to accept my upload. (I haven't tried to download.) I want to get it working in the development environment before I tried on the live site.
It's kind of confusing, because I don't know if I should be trying appcfg.py or bulkloader.py. (I mostly tried appcfg...
I'm using the authentication that ships with django, and as such, it comes with its own SQL table. I have a few more attributes I'd like to use with the User model that are custom to my app such as a user photo or a random user blob where users can type in notes.
what's the best way of extending the existing user table that ships with d...
I've run into something odd, here, and I'm at a loss -- I have a feeling this has something to do with floating precision, but I'm surprised Python would not display the approximation error, if so.
I'm working on Project Euler problem 62. As a simple test (I've since solved using a different approach), I had a is_cube which I intended ...
Just curious. If you had the time and inclination to create a programming language, what characteristics would it have?
One language I would like to see would borrow as much from the syntax of Python as possible but compile to machine code that runs as fast as C or C++.
...
>>> float(str(0.65000000000000002))
0.65000000000000002
>>> float(str(0.47000000000000003))
0.46999999999999997 ???
What is going on here and how do I convert 0.47000000000000003 to string and the resultant value back to float?
I am using python 2.5.4 on windows.
...
This function is from the book "Programming Collective Intelligence”, and is supposed to calculate the Pearson correlation coefficient for p1 and p2, which is supposed to be a number between -1 and 1.
If two critics rate items very similarly the function should return 1, or close to 1.
With real user data I sometimes get weird results....