Hurray: Django on Pydev

I am really looking forward to this one:

Pydev adventures: Django on Pydev

Advertisements
Published in: on March 22, 2010 at 10:04 am  Leave a Comment  

An open source web scraping framework for Python

Scrapy is a fast high-level screen scraping and web crawling framework, used to crawl websites and extract structured data from their pages. It can be used for a wide range of purposes, from data mining to monitoring and automated testing.

via Scrapy | An open source web scraping framework for Python.

Published in: on March 12, 2010 at 8:37 pm  Leave a Comment  

Command Line Warriors – SFTP in Python: Really Simple SSH

ssh.py provides three common SSH operations, get, put and execute. It is a high-level abstraction upon Paramiko.

via Command Line Warriors – SFTP in Python: Really Simple SSH.

Published in: on March 12, 2010 at 8:00 am  Leave a Comment  

Installing pysvn with MacPorts on Snow Leopard

On several of our Snow Leopard machines the MacPort installation of the pysvn package kept failing.

This command

sudo port install py26-svn +universal

exited with:

checking for Berkeley DB... not foundconfigure: error: Berkeley DB not found.
Error: The following dependencies failed to build: subversion apr-util neon serf
Error: Status 1 encountered during processing.
Before reporting a bug, first run the command again with the -d flag to get complete output.

For unknown reasons – the other day we were able to successfully install it on a MacBook Pro.

Here are the zipped binaries which have to be unzipped and copied to

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/

or wherever your $PYTHONPATH variable is pointing to.

Hope this helps somebody.

Published in: on March 10, 2010 at 2:57 pm  Leave a Comment  

Johnny Cache — Johnny Cache v0.1 documentation

Johnny Cache is a caching framework for django applications. It works with the django caching abstraction, but was developed specifically with the use of memcached in mind. Its main feature is a patch on Django’s ORM that automatically caches all reads in a consistent manner.

via Johnny Cache — Johnny Cache v0.1 documentation.

Published in: on March 1, 2010 at 9:31 pm  Leave a Comment  

Python Decorators Don’t Have to be (that) Scary – Siafoo

Decorators modify functions. Beginning with the basics, learn how to use decorators in a variety of ways. Execute code when a function is parsed or called. Conditionally call functions and transform inputs and outputs. Write customizable decorators that accept arbitrary arguments. And, if necessary, easily make sure your decorated function has the same signature as the original.

via Python Decorators Don’t Have to be (that) Scary – Siafoo.

Published in: on February 9, 2010 at 9:38 pm  Leave a Comment  

Monitor Windows CPU usage with Python

This little Python script lets you monitor the average CPU-load on a Windows machine. Needs WMI to be present.

import os

def get_cpu_load():
    """ Returns a list CPU Loads"""
    result = []
    cmd = "WMIC CPU GET LoadPercentage "
    response = os.popen(cmd + ' 2>&1','r').read().strip().split("\r\n")
    for load in response[1:]:
       result.append(int(load))
    return result

if __name__ == '__main__':
    print get_cpu_load()
Published in: on June 8, 2009 at 10:25 am  Comments (5)  

Cheat Sheet Central

Find a very useful overview of numerous “cheat sheets” at Smashing Magazine’s website. CSS, XHTML, C# and Python are only a few languages which are covered here.

The Apache Cheat Sheet is quite useful:

or the Regular Expressions cheat sheet: 

Published in: on December 17, 2006 at 5:59 pm  Comments (3)  

Finally found: THE Python IDE

As an old Zoper, I have been looking for a nice Python IDE over the last couple of years. I tried a few of the existing IDEs Komodo, Pydev and Wing IDE. There was always something “missing” – at least performance.

The other day my coworker ran into the free IDE Pyscripter, which from the first second looked very promising. The vendor says about it:

PyScripter is a Python IDE built in Python for Delphi(P4D) components and created with the ambition to become competitive in functionality with commercial Windows-based IDEs available for other languages. Being built in a compiled language is rather snappier than some of the other Python IDEs and provides an extensive blend of features that make it a productive Python development environment.

This IDE is my “tool of the week”. The performance is great and the functionality more or less the same as the other IDEs mentioned above.

To get it running you need a Python standalone installation on your system to be found on python.org.

To get access to the Zope INSTANCE_HOME and SOFTWARE_HOME packages you need to add those pathes to the python path in the IDE. Unfortunately we made the experience, that Pyscripter tends to forget this setting. A workaround seems to be to add the Zope pathes to the python path in the registry.

Just open regedit.exe, if you use Python 2.4, find the path HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.4\PythonPathHKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.4\PythonPath
and add the pathes. The restart PyScripter, and this is it.

sshot.gif

Published in: on December 17, 2006 at 12:29 pm  Comments (1)