Vizible’s Blog

cython cause install skype4py failed

Posted in Python by wearetherock on September 18, 2009
$ sudo python install
running install
running build
running build_py
running build_ext
cythoning Skype4Py/ to Skype4Py/utils.c

Error converting Pyrex file to C:
        self._EventHandlerObj = Obj

    def __AddEvents_make_event(Event):
        # TODO: rework to make compatible with cython
        return property(lambda self: self._GetDefaultEventHandler(Event),

/dos/library/Skype4Py/tar/Skype4Py- Expected an identifier or literal
building 'Skype4Py.utils' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I. -I/usr/include/python2.6 -c Skype4Py/utils.c -o build/temp.linux-i686-2.6/Skype4Py/utils.o -O3
gcc: Skype4Py/utils.c: No such file or directory
gcc: no input files
error: command 'gcc' failed with exit status 1


$ sudo apt-get remove cython
$ sudo python install
running install
running build
running build_py
copying Skype4Py/API/ -> build/lib.linux-i686-2.6/Skype4Py/API
copying Skype4Py/API/ -> build/lib.linux-i686-2.6/Skype4Py/API
copying Skype4Py/API/ -> build/lib.linux-i686-2.6/Skype4Py/API
running install_lib
byte-compiling /usr/local/lib/python2.6/dist-packages/Skype4Py/Languages/ to bg.pyc
byte-compiling /usr/local/lib/python2.6/dist-packages/Skype4Py/Languages/ to lt.pyc
byte-compiling /usr/local/lib/python2.6/dist-packages/Skype4Py/Languages/ to sv.pyc
byte-compiling /usr/local/lib/python2.6/dist-packages/Skype4Py/Languages/ to ro.pyc
byte-compiling /usr/local/lib/python2.6/dist-packages/Skype4Py/ to conversion.pyc
running install_egg_info
Writing /usr/local/lib/python2.6/dist-packages/Skype4Py-


Tagged with: , ,

C – Create share library

Posted in Programming by wearetherock on August 21, 2009

1. Code

// test.c
static char *name;
void printName(){
	printf("name = %s\n", name);
void setName(char *n){
	name = n;

2. Compile

> gcc -c test.c -o test.o
> gcc -shared -o test.o

3. Test

>>> from ctypes import cdll
>>> lib = cdll.LoadLibrary('')
>>> lib.setName('java')
>>> lib.printName()
name = java
Tagged with: , , ,

GoAhead! – I don’t known

Posted in Logs, Python by wearetherock on July 23, 2009

When I run python script there are username and password prompt


Enter username for GoAhead at localhost:8080:
Enter password for in GoAhead at localhost:8080:

What’s this? , i didn’t implement this thing.

Tagged with: , ,

Python – How to use Flickr API?

Posted in Python by wearetherock on July 11, 2009
# use
# API key get from flickr web site

import flickrapi
class Uploader :
	def __init__(self, apiKey, secretKey) : = flickrapi.FlickrAPI(apiKey, secretKey)
		(token, frob) ='write')
		if not token: raw_input("Press ENTER after you authorized this program"), frob))

	def showProgress(self, progress, done) :
		if done :
			print 'Done uploading'
		else :
			print 'At %s%%' % progress

	def upload(self, image): = image, callback = self.showProgress)

if __name__ == '__main__' :
	apiKey = 'xxxx'
	secretKey = 'xxxx'
	uploader = Uploader(apiKey, secretKey)
	image = 'into_the_wild.png'
Tagged with: ,

Python – Broadcast UDP II

Posted in Python by wearetherock on February 2, 2009

ทำต่อจากของเดิม Python – Broadcast UDP เมื่อ Tomboy บันทึกข้อมูล(เป็นช่วง ๆ) มันจะส่ง Signal ออกมา  ซึ่งเราจะส่งข้อมูลออกไปช่วงนั้นแต่ต้องตรวจสอบก่อนว่าผู้ใช้เขียนโน็ตเสร็จหรือยัง  โดยดูจาก ### ถ้ามี ### ตอนท้ายแสดงว่าเสร็จแล้ว โปรแกรมจะ Broadcast ข้อความนั้นออกไปทันที จบ

แต่พิมพ์ภาษาไทยไม่ได้ มัน error ตอน encode จะแก้ยังไง?

import dbus, gobject, socket
from dbus.mainloop.glib import DBusGMainLoop

class MyNote :
	def __init__(self):
		self.bus = dbus.SessionBus()
		self.object = self.bus.get_object("org.gnome.Tomboy", "/org/gnome/Tomboy/RemoteControl")
		self.tomboy = dbus.Interface(self.object, "org.gnome.Tomboy.RemoteControl")
		self.bus.add_signal_receiver(self.save_event_handler, "NoteSaved")
	def save_event_handler(self, note_uri):
		message = self.tomboy.GetNoteContents(note_uri)

		if message.endswith("###") :
			message.encode('utf-8')  # why not support thai, alway error when meet thai char..
	def send_to_other(self, message):

		my_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
		my_socket.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
		my_socket.sendto(message, ('<broadcast>',8881))

		print 'sent (%s) complete ..' % (message)

def main():
	DBusGMainLoop(set_as_default = True)
	note = MyNote()
	loop = gobject.MainLoop()

	print 'start ...'

if __name__ == "__main__" :
Tagged with: , , , ,