python

PyBluez - How can I find the signal strength between me and a device?

I'm looking into making a Python app that utilizes the PyBluez module to scan for devices and log their MAC address and signal strength. From looking at (code.google.com/p/pybluez/source/browse/trunk/examples/simple/asynchronous-inquiry.py), it seems very easy to scan for the devices and get their MAC address. What I can't find how to d...

facebook self.graph.put_object

Hi I using the Python SDK (http://github.com/facebook/python-sdk/) with Google app engine. I can post message on user wall with the self.graph.put_object function while the user is online. How do post a message to user wall directly from the server even the user is offline? ...

A tool to convert python regular expressions to mx.TextTools Tag Tables

Hi, Is there a tool, you know of, which can taken in a python regular expression and convert it to an mx.TextTools Tag table? Would you benefit from such a tool? ...

Not able to install a python module "Pycrypto-2.3"

hi all, I tried installing a python module "Pycrypto-2.3".But its giving the following long list of errors: running install running build running build_py running build_ext building 'Crypto.PublicKey._fastmath' extension /usr/lib/python2.6/pycc -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.6 -c src/_fastmath.c ...

Activate Python program every 5 minutes?

Is there an easy way to get a python code segment to run every 5 minutes? I know I could do it using time.sleep() but was there any other way? For example I want to run this every 5 minutes: x = 0 def run_5(): print "5 minutes later" global x += 5 print x, "minutes since start" That's only a fake example but the idea is ...

how to catch python syntx error

try: pattern=r'<tr><td><a href='(?P<link>[\s\S]*?)'[\s\S]*?><img src='(?P<img>[\s\S]*?)' width='130' height='130'[\s\S]*?/></a></td>' except: try: pattern=r"<tr><td><a href='(?P<link>[\s\S]*?)'[\s\S]*?><img src='(?P<img>[\s\S]*?)' width='130' height='130'[\s\S]*?/></a></td>" except: pattern=r"""<tr><td><a ...

How to convert hex string to hex number?

Hello all, I have integer number in ex. 16 and i am trying to convert this number to a hex number. I tried to achieve this by using hex function but whenever you provide a integer number to the hex function it returns string representation of hex number, my_number = 16 hex_no = hex(my_number) print type(hex_no) // It will print typ...

how to get all the users from the list in twitter?

I want to get all the user from a list using twitter api. But i have some query regarding this. Does this needs oauth authentication? I am using python. ...

IronPython cannot import module os

Hello, So I have a basic ZIPPED IronPython (2.6 or 2.6.1) that I just unzip, start ipy.exe, type "import os" and hit enter. The following output happens: Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named os It doesn't work even if I import clr first. What's it to be done ? I've goo...

Adding multiple field names in ArcGIS using Python

I was wondering if anyone out there would help me with a step in my HW assignment... So far this is my python program - which does what it is supposed to. # Import system modules import sys, string, os, arcgisscripting # Create the Geoprocessor object gp = arcgisscripting.create() # Load required toolboxes... gp.AddToolbox("C:/ArcGIS...

Immutable types allowing subclassing in Python

I want to have immutable types that can, ideally, sort out their own hashing and equality, but can be easily subclassed. I started off using namedtuple: class Command(namedtuple('Command', 'cmd_string')): def valid_msg(msg): return True def make_command(msg): if self.valid_msg(msg): return '%s:%s' % (self.cmd_string,...

Reading data from memcache sometimes fails

I've written a gevent-based program that allows its web clients to quickly exchange messages through it (so it works like a hub). Since I only support polling mechanism at this moment, I've written it to store messages that need to be delivered to a specific client in its 'inbox' at the server side. While the client list is stored in My...

return html for a web server and not plain text in python

here is my code : import socket import sys import re import base64 import binascii import time class Serverhttp: def __init__(self): self.GET = re.compile("GET.*?HTTP") self.POST = re.compile("GET.*?HTTP") try : sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server_address = ...

Django - Form widget with a checkbox to choose between unlimited or a textbox for a number

I am making a form in Django. The field to display is a numeric field representing some limit. It's possible for there to be no limit. Rather than force the user to enter some strange number to mean unlimited (e.g. -1), I'd like there to be a radio button, with 2 options: "Unlimited" and the second option being a text box that the user c...

calculating means of many matrices in numpy

I have many csv files which each contain roughly identical matrices. Each matrix is 11 columns by either 5 or 6 rows. The columns are variables and the rows are test conditions. Some of the matrices do not contain data for the last test condition, which is why there are 5 rows in some matrices and six rows in other matrices. My appli...

EOF while scanning triple-quoted string literal

i've looked on the web and here but i didn't find an answer : here is my code zlib.decompress(""" xワᆳヤ=ラᄇHナs~Ʀᄑç\ムîà Z@ÑÁÔQÇlxÇÆïPP~ýVãì゙M6ÛÐ|ê֭ᄁᄂヤ=)}éÓUe﬿ö3ᄎᄌú"}ʿïÿ÷1þ8ñ́U÷ᄏñíLÒVi:`ᄈᄎL!Ê҆p6-%Fë^ヘ÷à,Q.K!ユô`ÄA!ÑêweÌ ÊÚAロYøøÂjôóᅠÂcñ䊧fᆴùテúN :nüzAÝ7%ᄌcdUタᄌ3ôPۂタlンyHᆲᄑ$/yzᄒíàヌ'ÕÓ&`|S!<'ᄂ÷Zļᄐ2ホモ;ニ(ÅÛfb!úü$ナテᄒ,9ßhàPᄎᄄێフÑbØὛホQᄍ-Ü}(n;ᄄホLヤ\^ï9ᆭᄍラ...

How to Get Mail Body which has .eml attachment ?

I am developing Email client Application in Python. How to Get Mail Body which has .eml attachment using Imap ? ...

Multiproccessing with DB connection

I have some processes with python gui application and i want to connect with them to sql server. i use the following modules form multiproccessing import pool import pymssql conn = pymssql.connect(host=host,user=user,password=password,database=database) for data in my_list : self.pool.apply_async(fun,data,conn) i it possible ...

How to set up vsvars32 environment variables?

Hi, I'm struggling with setting my scons environment variables for visual studio 2008. Normally I do following: %VS90COMNTOOLS%vsvars32.bat or call %VS90COMNTOOLS%vsvars32.bat And this works in my shell. I try to do that in python using subprocess subprocess.call([os.environ['VS90COMNTOOLS']+r"\vsvars32.bat"]) output: d:\N\wo...

svg2css inkscape extention

I tried to use svg2css inkscape extension in python, which converts an svg file to its equivalent css+html, but it resulted in no output with a warning message: Source file C:\WINDOWS\Temp\ink_ext_XXXXXX.svg9EFDKV not an SVG. My svg file is very simple, it just contains one text tag, I tried to generate the css+html from these svg ...