Convert from unsigned long long to PyLong

2016-07-21 Thread Tian JiaLin
HI There, I'm using MySQLdb as the MySQL client. Recently I got a weird problem of this library. After looking into it, I suspect the problem may related to the conversion from unsigned long to PyLongObject. Here is the detail, If you are familiar with MySQLdb, the following snippet is a way t

Re: raw_input and break

2015-11-04 Thread tian . su . yale
) break print("You just entered:", inp) Is this along the line that you are thinking? As pointed out earlier, it will be much easier for people to help if you can share the exact code you put into and the error messages as well. Thanks and good luck! All the best, Tian -- https://mail.python.org/mailman/listinfo/python-list

Re: How to handle exceptions properly in a pythonic way?

2015-11-04 Thread tian . su . yale
ke it very informative. Hope this helps. All the best, Tian -- https://mail.python.org/mailman/listinfo/python-list

Re: How to handle exceptions properly in a pythonic way?

2015-11-04 Thread tian . su . yale
ably I would log it just for record keeping purpose. As long as you follow up and trace back to the root cause, they seem to serve the same goal. Hope this helps... All the best, Tian -- https://mail.python.org/mailman/listinfo/python-list

question on string object handling in Python 2.7.8

2014-12-24 Thread Dave Tian
Hi, There are 2 statements: A: a = ‘h’ B: b = ‘hh’ According to me understanding, A should be faster as characters would shortcut this 1-byte string ‘h’ without malloc; B should be slower than A as characters does not work for 2-byte string ‘hh’, which triggers the malloc. However, when I put

Re: How close program in the wxPython?

2005-05-04 Thread Tian
I know how to capture window close event, but what i want to do is to close window using commands. now i am simply using "sys.exit()" to close the whole program. but it seems that window close events will are be generated in this case. is there any function in wxpython that i can use to close appli

How close program in the wxPython?

2005-05-02 Thread Tian
I have made a program in wxpython, but how could i exit the program? I am using wxFrame for my window, what is the function to close the program? Thanks!! -- http://mail.python.org/mailman/listinfo/python-list

Re: How to execute a cmd line program without invoking console window?

2005-04-04 Thread Tian
this is very useful, thanks very much! -- http://mail.python.org/mailman/listinfo/python-list

How to execute a cmd line program without invoking console window?

2005-03-29 Thread Tian
In Windows, I have been simply using os.system() to run command line program in python. but there will be a black console window. How can I run the program without invoking that window? i guess there are some function with which I can redirect the output? -- http://mail.python.org/mailman/listinf

Re: Problem in designing a global directory in python

2005-03-29 Thread Tian
I googled about how to write singleton in python, but even if I use Singleton, in which module's namespace should I keep the instance of this singleton? suppose I have a singleton class definiton in "utils.py", how should I import and where should I make instance and initialize? Thanks!! -- http:

Re: Problem in designing a global directory in python

2005-03-29 Thread Tian
I have tried using "sysctx=None" instead of "global sysctx", but it doesn't work either. It seems my initialization work in the previous calling of init() has no persistent effect when "utils" is imported using "from myproj.utils import getContext". What's weird, when a module is in the same direc

Problem in designing a global directory in python

2005-03-29 Thread Tian
I want to create a object directory called Context in my program, which is based on a dict to save and retrieve values/objects by string-type name. I have the definition like this: utils.py global sysctx class Context: def __init__(self): def set(self, name, obj, over

newbie question: how to get the class instance given a module object?

2005-03-27 Thread Tian
I have a module called ModuleA.py, in which there is a class called Dog, what should I put in the "" part to get the instance of class Dog??? import ModuleA classname = "Dog" module = globals()["ModuleA"] classobj = ??? <---using classname instanct = classobj() -- http://mai

How to organize source code and "import"s???

2005-03-27 Thread Tian
I am writing a python program which needs to support some plug-ins. I have an XML file storing some dynamic structures. XML file records some class names whose instance needs to be created in the run time while parsing the XML file. I wonder what is the best solution for this problem? I also have

How two modules call functions defined in each other?

2005-03-19 Thread Tian
I am python beginner, I have a question about the interdependence of modules. For example, when I have two modules: module1.py - def plus(x): return add(x,1) module2.py - def add(x,y): return x+y def plus2(x): return plus(x)+1 How should I write "import" in both

Re: How to create an object instance from a string??

2005-03-19 Thread Tian
This is very useful, thanks! -- http://mail.python.org/mailman/listinfo/python-list

How to create an object instance from a string??

2005-03-19 Thread Tian
How can I create an instance of an object from a string? For example, I have a class Dog: class Dog: def bark(self): print "Arf!!!" I have a string: classname = "Dog" How can I create a instance of Dog from classname? Is there any such methods like those in Java? -- http://mail.python.o

How to write python plug-ins for your own python program?

2005-03-02 Thread Tian
description file. I will set some rules for plug-in writing (like you must inherit some class and implement some method). I hope plugin can be added while original program is running. Is there any good method to read in python code and test availability and invoke the functions inside? Thanks Tian

Re: pyFMOD problem

2005-02-03 Thread Tian
I think I did have put the DLL file in the correct place, but I still cannot make it work. same problem. I checked my version of pyfmod, ctypes, they are all the newest one. can you tell me the version you are using? Thanks -- http://mail.python.org/mailman/listinfo/python-list

pyFMOD problem

2005-02-02 Thread Tian
I am trying to use pyfmod in python to manipulate sound. i have installed pyfmod, ctype, numarray (if they are necessary), i also copied fmod.dll to python/DLLs as well as windows/system32, but when i tried import pyFMOD I got: Traceback (most recent call last): File "", line 1, in -topleve

Question about pyFMOD importing

2005-02-02 Thread Tian
Another question, where can I find a tutorial of pyFMOD? the document of FMOD itself is daunting and I don't know how exactly pyFMOD wraps it. Thanks!! Tian -- http://mail.python.org/mailman/listinfo/python-list