当前位置: 首页 > python
  • apache mod_python psp

    之前在apache上用python都是通过cgi的方式来调用,这次尝试了一下mod_python模块。

    yum安装apache,python,mod_python。
    安装过程忽略。
    注意python的默认版本,如果有多个版本的话,mod_python还是使用的系统的版本。

    阅读全文
    作者:2hei | 分类:python | 阅读:7,409 views | 标签:
    apache mod_python psp已关闭评论
  • run or spawn in pexpect

    Pexpect is a Python module for spawning child applications and controlling them automatically. Pexpect can be used for automating interactive applications such as ssh, ftp, passwd, telnet, etc. It can be used to a automate setup scripts for duplicating software package installations on different ...

    阅读全文
    作者:2hei | 分类:python | 阅读:4,178 views | 标签:
    run or spawn in pexpect已关闭评论
  • pexpect Timeout exceeded in read_nonblocking()

    gg resolve from bbs:vi /usr/lib/python2.6/site-packages/pxssh.py#add line 134,135:    123     def synch_original_prompt (self):    124     125         “””This attempts to fi ...

    阅读全文
    作者:2hei | 分类:python | 阅读:4,751 views
    pexpect Timeout exceeded in read_nonblocking()已关闭评论
  • useful python modules zz

    mark zz from http://bbs.chinaunix.net/viewthread.php?tid=1855562 :Graphical interface wxPython http://wxpython.org    Graphical interface pyGtk http://www.pygtk.org    Graphical interface pyQT http://www.riverbankcomputing.co.uk/pyqt/    Graphical interface Pmw http ...

    阅读全文
    作者:2hei | 分类:python | 阅读:3,993 views | 标签:
    useful python modules zz已关闭评论
  • compile pyhton2.7 with zlib

    ensure you have installed zlib on your OS. [2hei.net]# rpm -qa|grep zlib zlib-1.2.3-3 zlib-devel-1.2.3-3 use source code to compile python2.7: ./configure –enable-shared && make && make install If you still have this issue: python: error while loading shared libraries: li ...

    阅读全文
    作者:2hei | 分类:python | 阅读:3,868 views | 标签:,
    compile pyhton2.7 with zlib已关闭评论
  • DJANGO FORMS:This field is required

    when meet This field is required at django forms, we can add “required=False” at Fields. from django import forms class ContactForm(forms.Form):    subject = forms.CharField(max_length=100)    message = forms.CharField()    sender = forms. ...

    阅读全文
    作者:2hei | 分类:python | 阅读:3,783 views | 标签:
    DJANGO FORMS:This field is required已关闭评论
  • write nagios nrpe plugin

    Scripts and executables must do two things (at a minimum) in order to function as Nagios plugins:1.Exit with one of several possible return values2.Return at least one line of text output to STDOUT Plugin Return Code Service State Host State0 OK UP1 WARNING UP or DOWN/UNREACHABLE*2 CRITICAL DOWN ...

    阅读全文
    作者:2hei | 分类:OpenSource, python | 阅读:4,927 views | 标签:
  • write a own tools of WorldTime with pytz

    require : python2.6 pytz #!/usr/bin/env python# -*- coding: gbk -*-from datetime import datetime, timedeltafrom time import gmtime, strftimefrom pytz import timezoneimport pytz, time,os #def convert_datetime(unix_timestamp=1143408000, tz=1, long_fmt=1): def convert_datetime(dt=’2007-01-01 ...

    阅读全文
    作者:2hei | 分类:python | 阅读:3,016 views | 标签:
    write a own tools of WorldTime with pytz已关闭评论
  • python解析xml的字符集问题的处理

    python版本:2.6 案例一: test.xml<?xml version=”1.0″ encoding=”utf8″?>调用:xmldoc = minidom.parse(test.xml)报错:Traceback (most recent call last):  File “D:\project\src\myapp\src\xml\testdomxml.py”, line 14, in <module>    xml ...

    阅读全文
    作者:2hei | 分类:python | 阅读:5,283 views | 标签:,
  • linux下用python实现文本menu

    linux用shell实现menu比较简单,今天用python实现了一个,因为python没有switch语法,所以使用了dict来替代,另外调用了linux的clear来清屏,本例只是说明一下简单的实现方法,菜单的命令或者语句可以自由发挥 呵呵。 截个图先: 具体代码如下:#!/usr/bin/evn python# -*- coding: utf-8 -*-#Author: 2hei#2hei.net#Da ...

    阅读全文
    作者:2hei | 分类:OpenSource, python | 阅读:4,465 views | 标签:
    linux下用python实现文本menu已关闭评论
  • ImportError: No module named xen.xm

    xen的其中一个虚拟机无法使用,重启xen后发现无法启动。

    最后发现原因是升级了python版本所致,升级到了2.6.2:

    之前的版本是:python -V
    2.4.3

    降回到原来的python版本,重试OK!

    阅读全文
    作者:2hei | 分类:OpenSource, python | 阅读:3,791 views | 标签:
    ImportError: No module named xen.xm已关闭评论
  • python use BeautifulSoup crawl weather forecast

    python 使用BeautifulSoup(美汤)来抓取天气预报,简单的例子,只当练手 #!/usr/bin/env python# -*- coding: gb2312 -*- #get weather info from internet#http://weather.china.com.cn/city/54511_full.html import urllib,re,unicodedata,string,sys,refrom BeautifulSoup import * if __name__==”__main__&# ...

    阅读全文
    作者:2hei | 分类:OpenSource, python | 阅读:2,942 views | 标签:,
    python use BeautifulSoup crawl weather forecast已关闭评论
  • PYTHON_EGG_CACHE

    在使用python写的cgi是遇到如下问题Can’t extract file(s) to egg cache The following error occurred while trying to extract file(s) to the Python egg cache: [Errno 20] Not a directory: ‘/dev/null/.python-eggs’ The Python egg cache directory is currently set to: /dev/null/.python-e ...

    阅读全文
    作者:2hei | 分类:python | 阅读:5,152 views | 标签:
    PYTHON_EGG_CACHE已关闭评论
  • “小三” 也能玩大蛇

          小三(E63)入手已经几个月了,现在越发的感觉用着顺手,从dospy上看到了很多有价值的东西,也学到了不少关于symbian的知识。
         
          
    小三的功能强大,忍耐力超强、任劳任怨、毫无怨言,除了每早班车上一路陪伴的飞鱼秀外,还给装上了一堆经典老游戏(超级玛丽、泡泡龙、need for
    speed 街霸II、三国志、sky force 当然还有gameloft经典游戏asphalt4),装上了工作中经常用到的putty,还有可替代数据线的超级工具symsmb4,最近把我挚爱的大蛇(python)给捣鼓进去了,而且写了一个最经典的hello world!
          看了python for S60自带的贪吃蛇的代码,居然如此精炼,着实也让我兴奋了一番,有时间再研究下py2sis,咱也赶赶时髦,也整点手机应用啥的,最起码写出个win95来吧,哈哈!
    win95-1.jpg

    阅读全文
    作者:2hei | 分类:python | 阅读:3,974 views | 标签:,
    “小三” 也能玩大蛇已关闭评论
  • python的abc

    pyhon中很简单的模块调用 #!/usr/bin/python# Filename: abc.py def mymo():    print ‘hello world!’ #!/usr/bin/python# Filename: ehcoabc.py import abc abc.mymo() 执行结果如下:    AttributeError: ‘module’ object has no attribute ‘mymo’ ...

    阅读全文
    作者:2hei | 分类:python | 阅读:5,437 views
    python的abc已关闭评论
  • python 实现whois功能

    Linux下使用whois domain.name 即可获得该域名的注册信息,其实python也可以实现这个操作。 原理:调用python的socket模块,连接whois server,交互式输入需要查询的域名,获得返回的结果即可。 如同使用telnet: $telnet whois.internic.net 43Trying 199.7.51.74…Connected to whois.internic.net.Escape chara ...

    阅读全文
    作者:2hei | 分类:python | 阅读:6,855 views | 标签:
  • python use mysql

    python连接mysql中我遇到了这样的问题 Traceback (most recent call last):  File “<stdin>”, line 1, in <module>  File “build/bdist.linux-i686/egg/MySQLdb/__init__.py”, line 81, in Connect  File “build/bdist.linux-i686/egg/MySQLdb/connections.p ...

    阅读全文
    作者:2hei | 分类:python | 阅读:3,689 views | 标签:
    python use mysql已关闭评论
  • wndows下使用Python来修改文件时间戳

    windows下的文件时间戳有三个属性,创建时间、修改时间、访问时间,*nix下方便的多了,可以使用touch来进行修改,windows下也可以使用专门的工具来进行修改(别跟我说你是通过修改操作系统时间后再创建文件哟!)本文使用python2.6来进行处理,代码很简单,美中不足的是python提供的模块中并没有可以修改文件创建时间的 ...

    阅读全文
    作者:2hei | 分类:python | 阅读:5,664 views
    wndows下使用Python来修改文件时间戳已关闭评论