Hello guys,
I'm using appengine to develop an application. Ideally I would like to define a new kind (called Recipe) like this:
class Recipe(db.Model):
ingredients = db.ListProperty(type)
quantities = db.ListProperty(int)
However it seems that you cannot use "type" as the class value in ListProperty. I was thinking of instead ...
First of all I will say that I love python. Its Amazing in my eyes for what it is. I love programming in it, its actually fun. Lots of other people also love python and it has a large online development and user community. But it seems companies don't use it or are very reluctant to do so. When scanning classifieds I find 1 python j...
I have a JAR file midlet JAR file, which returns an INT value according to some input data...
Problem is, i need to get that INT value by calling the jar file via some python code (and send the required input data to get the result data). How can i access the functions and variables of a midlet JAR file?
I try to decompile JAR into ja...
I have data coming in from a machine (via pexpect) and I parse it using regexes into a dictionary like this
for line in stream:
if '/' in line:
# some matching etc which results in getting the
# machine name, an interface and the data for that interface
key=str(hostname)+":"+r.groups()[0][0:2]+r.groups()[2]...
hiyas. I using Genshi+Pylons.
please teach me, how use \n to <br/>tag in Genshi?
I hope to obtain the same result as "nl2br" in php to change line.
Or, does not the solution exist?
i'm assign template to some text.
(genshi template)
<p>${c.message}</p>
Im tried.
case 1:
(python code)
c.message = """
foo
bar
"""
NG. display res...
I'm making a python script that needs to do 3 things simultaneously.
What is a good way to achieve this as do to what i've heard about the GIL i'm not so lean into using threads anymore.
2 of the things that the script needs to do will be heavily active, they will have lots of work to do and then i need to have the third thing reporting ...
I'm using Notepad++ editor on windows with format set to ASCII,
I've read "PEP 263: Source Code Encodings" and amended my code accordingly (I think), but there are characters still printing in hex...
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import os, sys
a_munge = [ "A", "4", "/\\", "\@", "/-\\", "^", "aye", "?" ]
b_munge = [ "B", "...
I'm looking for a GUI toolkit/framework to create applications that run on Mac Snow Leopard and preferably other systems(Windows, Linux).
Deal breakers:
X11 based
Non-native widgets
32 bit/Carbon
Bad Mac look and feel
As far as I know Tkinter runs X11 and wxWidgets and PyQT do not run 64 bit.
Is there anything usable for good looki...
There are at least half a dozen Django apps that provide OpenID authentication for Django:
django-openid
django-openid-auth
another django-openid-auth, which seems to be dead
django-authopenid
django-socialauth (which also provides authentication with Twitter and Facebook accounts)
django-socialregistration (has Facebook and Twitter au...
I'm trying to make a 4x4 sudoku solver in Python (I'm only a beginner!) and while trying to define a function to clean up my code somewhat, I ran across some strange behavior I don't really understand. Apparently, there's a difference between this:
sudoku = "0200140000230040"
sudoku = map(lambda x: '1234' if x=='0' else x, list(sudoku)...
I have a upload script done. But i need to figure out how to make a script that I can run as a daemon in python to handle the conversion part and moving the file thats converted to its final resting place. heres what I have so far for the directory watcher script:
#!/usr/bin/python
import os
import pyinotify import WatchManager, Notif...
I need a method of paramiko based file transfer with a lightweight SSH2 server (dropbear) which has no support for SCP or SFTP. Is there a way of achieving a cat and redirect style file transfer, such as:
ssh server "cat remote_file" > local_file
with paramiko channels?
Can paramiko.Transport.open_channel() or Message() do the job? I...
Consider the following class definitions
class of2010(object):
def __init__(self):
self._a = 1
self._b = 2
self._c = 3
def set_a(self,value):
print('setting a...')
self._a = value
def set_b(self,value):
print('setting b...')
self._b = value
def set_c(self,value):
...
Hi,
I have a big list of Twitter users stored in a database, almost 1000.
I would like to use the Streaming API in order to stream tweets from these users, but I cannot find an appropriate way to do this.
Help would be very much appreciated.
...
I'm new to Python, and I'm using Google App Engine to build a simple blog to help me learn it. I have the following test code:
entries = db.Query(Entry).order("-published").get()
comments = db.Query(Comment).order("published").get()
self.response.out.write(template.render(templatePath + 'test.django.html', { 'entries': e...
Hello, I want to set up a Mercurial SC server and have been following the instructions found here: http//stackoverflow.com/questions/818571/how-to-setup-mercurial-and-hgwebdir-on-iis
I have checked all my settings multiple times and cannot seem to get passed this error after completing the configuration. Any advice would be helpful. T...
Two Python strings with the same characters, a == b,
may share memory, id(a) == id(b),
or may be in memory twice, id(a) != id(b).
Try
ab = "ab"
print id( ab ), id( "a"+"b" )
Here Python recognizes that the newly created "a"+"b" is the same
as the "ab" already in memory -- not bad.
Now consider an N-long list of state names
[ "Ari...
everything i have tried has given me wrong output values. i even copied C codes and changed them so that they would work in python and i still get wrong outputs. what is wrong?
import os, math
def makehex(value,size=8):
value = hex(value)[2:]
if value[-1] == 'L':
value = value[0:-1]
while len(value)<size:
va...
public interface IInterface
{
void show();
}
public class MyClass : IInterface
{
#region IInterface Members
public void show()
{
Console.WriteLine("Hello World!");
}
#endregion
}
How do I implement Python equivalent of this C# code ?
class IInterface(object):
def __init__(self):
pass
...
This might be a silly question, but, given the output of, say..
>>> from dis import dis
>>> def myfunc(x):
... print x ** 2
...
>>> dis(myfunc)
2 0 LOAD_FAST 0 (x)
3 LOAD_CONST 1 (2)
6 BINARY_POWER
7 PRINT_ITEM
8 PRINT...