python

GUI's Over Running Programs in python

Just wondering if there is any kind of framework or method of making a Gui that will override (Stay on top of) all other windows in python. Including Games or other programs that seem to "Take over" the computers Graphical processes. Any point in the right direction would be much appreciated... PS. The OS in question is Windows 7, but a...

Python3.0 TypeError

Usually one comes across this problem in python3.0 while attempting a split() method on a bytes type object. TypeError: Type str does'nt support the buffer API This issue can be resolved by using the split method after decoding the bytes type object. However, I find the error message rather ambiguous. Am I missing some underlying ...

Python OpenGL module - can't render basic triangle

I'm trying to use the OpenGL module with Python. Here is my source: pygame.init() screen = pygame.display.set_mode((800, 600), HWSURFACE|OPENGL|DOUBLEBUF) def init(): glEnable(GL_DEPTH_TEST) glShadeModel(GL_FLAT) glClearColor(1.0, 1.0, 1.0, 0.0) glEnable(GL_COLOR_MATERIAL) glEnable(GL_LIGHTI...

Can I recursively create a path in Zookeeper?

I'm pulling ZooKeeper into a project for some concurrency management, and the first thing I tried was something that, to me, was quite obvious (using the zkpython binding): zh = zookeeper.init('localhost:2181') zookeeper.create(zh, '/path/to/a/node', '', [ZOO_OPEN_ACL_UNSAFE]) And I got back a NoNodeException for my trouble. After re...

What's wrong with my Python installation, or I just was too dumb?

I downloaded and installed Python 3.1.2 on Windows 7 x64. But it seems that it's not working as expected, for example: Please help me figure out, what's wrong here? ...

how to setup "ip address","DNS", "hostname","MAC address" in python?

Dear All, I want to write a script for network security IP scan porpose, such a tool may need spoofing it's host NIC status for testing purpose, for example, to setup NIC's ip address, to setup DNS address, while to setup hostname, MAC address and enable/disable the NICs adapter. I googled and found most soultion is using "popen" ...

saving data and calling data python

say i want to ask the many users to give me their ID number and their name, than save it. and than i can call any ID and get the name. can someone tell me how i can do that by making a class and using the _ _ init _ _ method? ...

Python vs F#: which language I should learn

Hey, I know this is an subjective question, but please don't vote to close it before I get the acceptable answer. I'm a .NET programmer (somewhat experienced), and really want to learn a functional language. My preferred choices are F# and Python, and I'm really doubting about which one to choose. Please clear my doubts. I'm totally new...

Prototyping a filesystem

What are some best practises for prototyping a filesystem? I've had an attempt in Python using fusepy, and now I'm curious: In the long run, should any respectable filesystem implementation be in C? Will not being in C hamper portability, or eventually cause performance issues? Are there other implementations like FUSE? Evidently c...

Filtering in Python/Django based on date, ignoring time

I'd like to filter objects to the day with datetime, but can't find examples on how to do this anywhere. This, for example, works perfectly in pulling together all following events: @login_required def invoice_picker(request): """Grab a date from the URL and show all the invoicable deliveries for that day.""" query = request.GE...

Python SESSION (like php) class

Hi All, is there any class to handle a SESSION (like php) in Python? not in django, but I want to use it with PyQt thank you ...

python FLV checker

i need a simple python lib that check the uploaded files to my webserver are flash media (FLV), by reading the flv header (metadata) and not the mimetype extension. ...

mod_wsgi + apache not multithreaded, why?

WSGI application # coding: utf-8 import time def application(environ, start_response): status = '200 OK' output = str(time.time()) time.sleep(5) output += ' -> ' + str(time.time()) response_headers = [('Content-type', 'text/html; charset=utf-8'), ('Content-Length', str(len(output)))] s...

Extract a specific portion of connection string

Hello, Any way to extract what's after the @(if any) and before the next . (if any)? Examples: host host.domain.com user@host first.last@host [email protected] [email protected] I need to get host in a variable. Suggestions in Python? Any method is welcomed. Thanks, EDIT: I fixed my question. Need to match host and h...

How can I use decorators in Python to specify and document repeated used arguments of methods?

One of my classes has a logical numpy array as parameter in many methods repeated (idx_vector=None). How can I use a decorator to: automatically specify idx_vector automatically insert the description into the docstring Example without decorator: import numpy as np class myarray(object): def __init__(self, data): self.data = ...

how to upload python application with google apps???

Hey I developed one application and upload on example.appspot.com now i want to upload it on www.example.com what to do??? pls reply fast.. ...

Google app engine handle html form post array

My HTML code as following: <INPUT type="text" name="txt[]"> <INPUT type="checkbox" name="chk[]"/> I get the value in PHP by <?php $chkbox = $_POST['chk']; $txtbox = $_POST['txt']; foreach($txtbox as $a => $b) echo "$chkbox[$a] - $txtbox[$a] <br />"; ?> How do get the value in Google App Engine using Python? ...

Is it possible to run doctests using unit2

I recently switched from nose to the new unittest2 package for my python unit testing needs. It does everything I want, except from the fact that I can't get its "discover" command to recognize the doctests in my code - I still have to use nose to run them. Is this not implemented or is there something I'm missing here? ...

passing C++ classes instances to python with boost::python

I have a library which creates objects (instances of class A) and pass them to a python program which should be able to call their methods. Basically I have C++ class instances and I want to use them from python. Occasionally that object should be passed back to C++ for some manipulations. I created the following wrapper file (let's as...

I want one backslash - not two

I have a string that after print is like this: \x4d\xff\xfd\x00\x02\x8f\x0e\x80\x66\x48\x71 But I want to change this string to "\x4d\xff\xfd\x00\x02\x8f\x0e\x80\x66\x48\x71" which is not printable (it is necessary to write to serial port). I know that it ist problem with '\'. how can I replace this printable backslashes to unprintable?...