SPE
Is SPE open source? I want to try to implement a windows compiler into the GUI using py2exe. thanks! -Glich -- http://mail.python.org/mailman/listinfo/python-list
Re: SPE
After posting this message I realized the stupid mistake I had made! But it was too late to change! I think patching it with py2exe would be a good idea. Greetings also, Glich -- http://mail.python.org/mailman/listinfo/python-list
FreeType
Hi, where can I download freetype (>= 2.1.7)? I need it to use matplotlib. I have search a lot but still can not find it. Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: FreeType
I've been there. All the code is in C/C++, don't I need it in python? I will explore the software. I dismissed this because there was no python. I am knew to all of this. Thanks for your reply. -- http://mail.python.org/mailman/listinfo/python-list
Re: Start
I got started here: http://showmedo.com/videos/python -- http://mail.python.org/mailman/listinfo/python-list
Getting callfunc from ast code.
"""Hi, how can I extend the code shown below so that I can identify
any "CallFunc" in "func.code" and identify the value of "node" in
"CallFunc"? Thanks.
This is my code so far:
"""
""" Given a python file, this program prints out each function's name
in that file, the line number and the ast code of that function.
"""
import compiler
import compiler.ast
parse_file = compiler.parseFile("/home/glich/file.py")
count = 0
while count < (len(parse_file.node.nodes) - 1):
func = parse_file.node.nodes[count]
print "\nFunc name: " + str(func.name)
print "Func line number: " + str(func.lineno) + "\n"
print str(func.code) + "\n"
count += 1
"""file.py:
def fun1():
print "Hi"
hi = "1"
fun2()
fun4()
def fun2():
fun3()
def fun3():
fun4()
def fun4():
print "Hi"
fun1()
"""
--
http://mail.python.org/mailman/listinfo/python-list
Re: Getting callfunc from ast code.
Your help is very useful. I would not be able to progress without you! Thanks. -- http://mail.python.org/mailman/listinfo/python-list
parsing ast nodes help to get callfunc values.
"""
Hi! This is my code so far:
This code analyzes a python file.
How can I separate CallFunc from the est of the ast node?
file.py is as follows:
_
def fun1():
print "Hi"
fun2()
fun4()
def fun2():
pass
def fun4():
pass
fun1()
_
The output from running this program (not file.py) is:
_
Func name: fun1
Func line number: 1
Stmt([Printnl([Const('Hi')], None), Discard(CallFunc(Name('fun2'), [],
None, None)), Discard(CallFunc(Name('fun4'), [], None, None))])
isinstance false
Func name: fun2
Func line number: 6
Stmt([Pass()])
isinstance false
Func name: fun4
Func line number: 9
Stmt([Pass()])
isinstance false
Traceback (most recent call last):
File "/home/glich/compi.py", line 15, in
print "\nFunc name: " + str(func.name)
AttributeError: Discard instance has no attribute 'name'
_
Please note the traceback is not important right now. I can deal with
that on my own.
What I want to do is sepperate "CallFunc(Name('fun2'), [], None,
None)" from each "func.code" and furthermore to get "fun2" from
"CallFunc(Name('fun2'), [], None, None)" (my ultimate goal!).
I gues I could split the string but I need to be able to get
"CallFunc(Name()" from "func.code" which might have multiple
"CallFunc(Name()" such as:
"Stmt([Printnl([Const('Hi')], None), Discard(CallFunc(Name('fun2'),
[], None, None)), Discard(CallFunc(Name('fun4'), [], None, None))])"
which is an "ast" repesentation of the function "fun1" in "file.py".
If some one could show me how to use something called "visitor"? I
would be very grateful. I did not understand the documentation and I
am in need of more SIMPLE example code. Any way, thanks.
Is there somthing along the lines of:
>>> first_callfunc = func.code.callfunc(1)
>>> second_callfunc = func.code.callfunc(2)
>>> third_callfunc = func.code.callfunc(3)
>>> print first_callfunc
CallFunc(Name('fun2'), [], None, None)
"""
import compiler
import compiler.ast
parse_file = compiler.parseFile("/home/glich/file.py")
count = 0
for count, func in enumerate(parse_file.node.nodes):
print "\nFunc name: " + str(func.name) # Prints function name.
print "Func line number: " + str(func.lineno) + "\n"
print str(func.code) + "\n"
if isinstance(func, compiler.ast.CallFunc):
print "isinstance true" # This should be called
sometimes.
else:
print "isinstance false"# This is always called but
why?!?!?
--
http://mail.python.org/mailman/listinfo/python-list
Control mouse position and clicking
hi, how can I, control mouse position and clicking from python? I want to interact with a flash application inside firefox. thanks. ps: I am not using windows. -- http://mail.python.org/mailman/listinfo/python-list
Re: Control mouse position and clicking
I am running ubuntu. :) -- http://mail.python.org/mailman/listinfo/python-list
python, dbus and pointers help.
''' hello, using pidgin instant messenger I can get the value of 'message' when one is being sent but, I dont know how to chage the value of message. from the documentation (http://developer.pidgin.im/doxygen/dev/html/ conversation-signals.html#sending-im-msg): _ sending-im-msg: Emitted before sending an IM to a user. message is a pointer to the message string, so the plugin can replace the message before being sent. _ I think python get's a copy of the message (this is just a guess). How can I change the message before it is sent? Thanks. The code is taken from http://developer.pidgin.im/wiki/DbusHowto#Furtherreading and changed only a small amount. ''' #!/usr/bin/env python def cb_func(account, rec, message): #change message here somehow? print message import dbus, gobject from dbus.mainloop.glib import DBusGMainLoop dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) bus = dbus.SessionBus() bus.add_signal_receiver(cb_func, dbus_interface="im.pidgin.purple.PurpleInterface", signal_name="SendingImMsg") loop = gobject.MainLoop() loop.run() -- http://mail.python.org/mailman/listinfo/python-list
Re: python, dbus and pointers help.
or a way of letting me see the message then cancel sending it then I could create a new message and send that one. but I cant see this in the documentation -- http://mail.python.org/mailman/listinfo/python-list
Re: python, dbus and pointers help.
A replay from ubuntu forums: by Roptaty: Using dbus you can only get information from Pidgin, you cant modify the information. To do this, you need to write a plugin loaded in Pidgin. (See http://developer.pidgin.im/wiki/DbusHowto ) -- http://mail.python.org/mailman/listinfo/python-list
