background preloader

About Pocoo — Pocoo

About Pocoo — Pocoo

Home | Read the Docs kodos | Free Development software downloads Announce: Stallion v0.2 released ! | Pyevolve I just tagged and released the v0.2 version of the Stallion. In the change log (Github project page), you can see that a lot of bugs were fixed and some new features were introduced in this release. I added compatibility with almost all Python 2.x versions, PyPy 1.7+ (and probably older versions too), I also fixed the compatibility with the Internet Explorer browser, now you should be able to use Stallion with Chrome, Firefox and IE. The most important feature introduced is the global checking for updates (a lot of people requested it): The new checking is under the menu “PyPI Repository”. Some small visual enhancements were also introduced, like the little gray marker next to the selected package: I hope you liked, I’m looking forward to implement more features as soon as possible, but a new version shouldn’t be released until next year. Visit the project page at Github to get instructions on how to update or install Stallion. - Christian S.

Python threads: Communication and Stopping A very common doubt developers new to Python have is how to use its threads correctly. Specifically, a large amount of questions on StackOverflow show that people struggle most with two aspects: How to stop / kill a threadHow to safely pass data to a thread and back I already have a blog post touching on these issues right here, but I feel it’s too task-specific for sockets, and a more basic and general post would be appropriate. I assume the reader has a basic familiarity with Python threads, i.e. has at least went over the documentation. So, without further ado, here’s a sample "worker" thread implementation. 01.import os, time 02.import threading, Queue 04.class WorkerThread(threading.Thread): 16. def __init__(self, dir_q, result_q): 17. super(WorkerThread, self). 18. self.dir_q = dir_q 19. self.result_q = result_q 20. self.stoprequest = threading.Event() 22. def run(self): 28. while not self.stoprequest.isSet(): 29. try: 30. dirname = self.dir_q.get(True, 0.05) 31. filenames = list(self. 2. try:

Unicode for dummies — Python Encoding We Recommend These Resources Another entry in an irregular series of posts about Unicode. This is a story about encoding and decoding, with a minor subplot involving Unicode. As our story begins — on a dark and stormy night, of course — we find our protagonist deep in thought. He is asking himself “What is an encoding?” What is an encoding? The basic concepts are simple. Next, (for reasons that we won’t explore right now) we need to be able to translate a message in a plain-text representation into some other representation (let’s call that representation the “encoded text”), and we need to be able to translate the encoded text back into plain text. There are three points worth noting about this process. The first point is that no information can be lost during encoding or decoding. The requirement for a lossless round-trip means that the mapping between the plain text and the encoded text must be very tight, very exact. in encoded text. And the reverse is also true. Unicode Is it, say, this.

paolovictor/mockaccino - GitHub Python socket programming tutorial | Binary Tides Network programming in python This is a quick guide/tutorial on socket programming in python. Socket programming python is very similar to C. To summarise the basics, sockets are the fundamental "things" behind any kind of network communications done by your computer. In this tutorial we shall be programming tcp sockets in python. Before you begin This tutorial assumes that you already have a basic knowledge of python. So lets begin with sockets. Creating a socket This first thing to do is create a socket. Function socket.socket creates a socket and returns a socket descriptor which can be used in other socket related functions The above code will create a socket with the following properties ... Address Family : AF_INET (this is IP version 4 or IPv4) Type : SOCK_STREAM (this means connection oriented TCP protocol) Error handling If any of the socket functions fail then python throws an exception called socket.error which must be caught. Ok , so you have created a socket successfully. Note 1.

Related: