In turbogears 1 that was easy:
Class controller(Controller)
@expose()
def method1(self, **kw):
print 'bla'
return self.method2(**kw)
@expose('template2')
def method2(self, **kw):
print 'bli'
return dict(**kw)
when I call method1, what I got was the template2 called by method2.
but in t...
So I'm writing yet another Twisted based daemon. It'll have an xmlrpc interface as usual so I can easily communicate with it and have other processes interchange data with it as needed.
This daemon needs to access a database. We've been using SQL Alchemy in place of hard coding SQL strings for our latest projects - those mostly done f...
Hello. I have a file of IP addresses called "IPs". When I parse a new IP from my logs, I'd like to see if the new IP is already in file IPs, before I add it. I know how to add the new IP to the file, but I'm having trouble seeing if the new IP is already in the file.
!/usr/bin/python
from IPy import IP
IP = IP('192.168.1.2')
#f=open(IP(...
I have a package named jiva_tasks, which I'm trying to import via celery (using the CELERY_IMPORTS attribute of celeryconfig. The import statement that celery is using is this:
__import__(module, [], [], [''])
Oddly enough, when this syntax is used, the module gets imported twice, once as jiva_tasks and another time as jiva_tasks. (w...
I got a prototype working of exposing C++ classes & methods to python using SWIG. I had to create a DLL (.pyd) of the classes/members I want to expose (_MyModule.pyd & MyModule.py).
But now I want to expose classes/members/functions in the exe. How to do this? Refactoring the exe is not an option.
One way is to create a wrapper dll fo...
Hello,
I am currently trying to get python bittorrent tracker running inside of jython and i encountered this problem:
the tracker uses PyCrypto library which i compiled for my platform and added into the python path. When i try to run code, however, i get following error:
Exception in thread "MainThread" Traceback (most recent call la...
Suppose you have a Django view that has two functions:
The first function renders some XML using a XSLT stylesheet and produces a div with 1000 subelements like this:
<div id="myText">
<p id="p1"><a class="note-p1" href="#" style="display:none" target="bot">✽</a></strong>Lorem ipsum</p>
<p id="p2"><a class="note-p2" href="#" s...
Please tell me I'm missing something really obvious here:
$ cat ~/bashplay/f
#!/bin/bash
read -p 'RDY> ' x
echo $x
$ ~/bashplay/f
RDY> direct execution
direct execution
$ ssh somehost ~/bashplay/f
indirect via ssh
indirect via ssh
Note the missing "RDY>" prompt when using ssh. I see the same thing in python when using the "readline"...
i want to make a upload progress bar, but i don't know how to get the upload progress of the file or image that is uploading, someone know how can i do this with Django??
thanks and sorry for my english!
...
I'm trying to solve the following problem: Say I have a Python script (let's call it Test.py) which uses a C++ extension module (made via SWIG, let's call the module "Example"). I have Test.py, Example.py, and _Example.so in the same directory.
Now, in the middle of running Test.py, I want to make a change to my Example module, recomp...
I reference this file "kbdext.c" and its headerfile listed on http://www.docdroppers.org/wiki/index.php?title=Writing_Keyloggers (the listings are at the bottom).
I've been trying to compile this into a dll for use in Python or Visual Basic, but have not succeeded. I'm not familiar with C or GCC to sort out the problems or do the dll co...
I have a Gnome applet written in Python. In order to save configuration data/settings, it creates a file ~/.appname.
However, this prevents multiple instances of the applet from being added to the panel because each cannot have its own settings.
How can I store the settings in a way that allows each instance to have its own unique sett...
I am trying to print the output of the following code in two columns using the python launcher:
def main():
print "This program illustrates a chaotic function"
n = input("How many numbers should I print? ")
x = input("Enter a numbers between 0 and 1: ")
y = input("Enter another number between 0 and 1: ")
for i in ran...
Hi,
I'm programing on C++, I'm using Visual Studio 2008, Windows XP, and I have the following problem:
My application, that is a DLL that can be used from Python, loads an external dll, uses the required methods, and then unloads this external Dll.
It's working properly, but after more than 1000 cycles the method "LoadLibraryA" returns ...
I'm trying to interface a C++ library (pHash) with Python using Cython, but I have trouble with some of the types. The library functions use "unsigned long long" and I can't find a way to declare variables and parameters with this type. I searched for a list of the types that I can use with cdef but I found nothing. Can anyone point me t...
Hello all.
I am developing application in python on Windows CE which needs connection to the internet (via GPRS/EDGE). When I turn on the device, the internet connection is not active. It becomes active if I open internet explorer.
I would like to activate connection in my application. I'm trying to do this with RasDial function over ...
With a scripting language like python (or php), things are not compiled down to bytecode like in .net or java.
So does this mean that on every request, it has to go through the entire application and parse/compile it? Or at least all the code required for the given call stack?
...
I have a variable in Python containing a floating point number (e.g. num = 24654.123), and I'd like to determine the number's precision and scale values (in the Oracle sense), so 123.45678 should give me (8,5), 12.76 should give me (4,2), etc.
I was first thinking about using the string representation (via str or repr), but those fail f...
Here is the site mock-up I'm working on for my job: http://dev.arm.gov/~noensie/dqhands/cgi-bin/explorer. I'm still a novice in web developing and I need help with placing form values in a list item to pass on to another page.
I'd rather not go in great detail the purpose of this website, but in terms of its basic use, select the parame...
Using elementree, the easiest way to read the text of a tag is to do the following:
import elementtree.ElementTree as ET
sKeyMap = ET.parse("KeyMaps/KeyMap_Checklist.xml")
host = sKeyMap.findtext("/BrowserInformation/BrowserSetup/host")
Now I want to update the text in the same file, hopefully without having to re-write it with someth...