Embedding Python27 in C++ on Windows: CRT compatibility issues with VS2010?

2012-05-24 Thread Stephen Lin
Hello, I'm a relative python newbie but I've been tasked to figure out how to embed calls to a python library in an Excel XLL add-in. The Python/C API for doing this seems pretty straightforward, but I seem to have read somewhere online that it's important that the C++ program or DLL linking to a

Methods on file-like objects can only used once on one object?

2011-08-23 Thread Yingjie Lin
Hi Python users, I just realize that my post yesterday shouldn't be specifically for mechanize. It should be a general question for file-like objects. >>> f = open('my_file.txt') >>> print f.readlines() ( prints a list of strings >>> print f.readlines() [] There are quite a few methods

Help on instance of closeable_response in module Mechanize

2011-08-22 Thread Yingjie Lin
Hi Python users, I have a question about the instance of closeable_response in module Mechanize. from mechanize import ParseResponse, urlopen url = "http://wwwsearch.sourceforge.net/mechanize/example.html"; r = urlopen(url) forms = ParseResponse(r, backwards_compat

Re: try... except with unknown error types

2011-08-19 Thread Yingjie Lin
Hi Zero, I see! This is very helpful. Thank you. - Yingjie On Aug 19, 2011, at 3:30 PM, Zero Piraeus wrote: > : > > On 19 August 2011 15:09, Yingjie Lin wrote: >> >> I have been using try...except statements in the situations where I can >> expect a certain

Re: HTML client sctript

2011-08-19 Thread Yingjie Lin
Hi John and Chris, Thanks for the help. I looked at both and think that mechanize suits my needs better, since it simply needs a python script and doesn't depend on Firefox. Yingjie > From: John Gordon > Mechanize seems like what you want. It's built on top of > urllib2.http://wwwsearch.s

try... except with unknown error types

2011-08-19 Thread Yingjie Lin
Hi Python users, I have been using try...except statements in the situations where I can expect a certain type of errors might occur. But sometimes I don't exactly know the possible error types, or sometimes I just can't "spell" the error types correctly. For example, try: response

HTML client sctript

2011-08-19 Thread Yingjie Lin
Hi Python users, I am maintaining a website written with Python CGI scripts. To make sure the website is working well, I would like to have a script which automatically "uses" this website and checks it's output everyday. It would be better if this script runs from the clients' side. Could any

pairwise combination of two lists

2011-08-17 Thread Yingjie Lin
Hi Python users, I have two lists: li1 = ['a', 'b'] li2 = ['1', '2'] and I wish to obtain a list like this li3 = ['a1', 'a2', 'b1', 'b2'] Is there a handy and efficient function to do this, especially when li1 and li2 are long lists. I found zip() but it only gives [('a', '1'), ('b', '2')],

python cgi webpage won't redirect before background children processes finish

2011-02-22 Thread Yingjie Lin
Hi all, I have a python cgi script which looks like this: [CODE STARTING HERE] open('x') print 'Content-Type: text/html\n\n' .. print '' % myURL .. ### after printing the webpage os.system('python myfile.py') logfile.write('END OF SCRIPT') logfile.close() [CODE ENDING] Question:

Re: A tool for find dependencies relationships behind Python projects

2010-02-24 Thread Victor Lin
   {'__file__':setup_script, '__name__':'__main__'} >    File "setup.py", line 9, in >    File "/tmp/easy_install-uPz7qO/Gluttony-0.3/gluttony/__init__.py", > line 1, in >      # >    File "/tmp/easy_install-uPz7qO/Glutton

A tool for find dependencies relationships behind Python projects

2010-02-19 Thread Victor Lin
/gluttony/tg2_dot.png Hope this could be helpful :P Regards. Victor Lin. -- http://mail.python.org/mailman/listinfo/python-list

Memory usage problem of twisted server

2010-01-20 Thread Victor Lin
rect? How can I monitor the memory allocation of Python? Is there any available tools for this? Or is that modifying the Python source code and recompiling the only way to monitor allocation of memory? Thanks. Victor Lin. -- http://mail.python.org/mailman/listinfo/python-list

Re: Ask how to use HTMLParser

2010-01-07 Thread Water Lin
h0uk writes: > On 8 янв, 08:44, Water Lin wrote: >> I am a new guy to use Python, but I want to parse a html page now. I >> tried to use HTMLParse. Here is my sample code: >> -- >> from HTMLParser import HTMLParser >> from urllib2 im

Ask how to use HTMLParser

2010-01-07 Thread Water Lin
parse it. I can locate the div tag but I don't know how to get the text for the tag which is "open article title" in my example. How can I get the html content? What's wrong in my handle_data function? Thanks Water Lin -- Water Lin's notes and pencils: http://en.waterlin.org Email: water...@ymail.com -- http://mail.python.org/mailman/listinfo/python-list

Any c header parser for generate ctypes module?

2009-03-09 Thread Victor Lin
arser that parse header of c library and generate ctypes python module automatically. My question is, is there any available tools can achieve this? If not, what tool can I use to such a job easily. I need a c parser, is there any C parser written in python? Thanks. Victor Lin. -- http://mail.pytho

Re: Callback from c thread with ctypes

2009-03-08 Thread Victor Lin
On 3月8日, 下午10時20分, Christian Heimes wrote: > Victor Lin wrote: > > Hi, > > > I am going to develop a c library binding with ctypes. That c library > > will call callback from worker threads it created. Here comes the > > problem : Will the GIL be acquired before it

Re: Callback from c thread with ctypes

2009-03-08 Thread Victor Lin
On 3月8日, 下午9時56分, "Diez B. Roggisch" wrote: > Victor Lin schrieb: > > > > > Hi, > > > I am going to develop a c library binding with ctypes. That c library > > will call callback from worker threads it created. Here comes the > > problem : Wi

Callback from c thread with ctypes

2009-03-08 Thread Victor Lin
allback. As the document says. WINFUNCTYPE will release GIL during the call But it does not mention callback about Python function? How about a call from another thread? Could somebody help me? Thanks. Victor Lin. -- http://mail.python.org/mailman/listinfo/python-list

How to debug deadlock?

2009-02-08 Thread Victor Lin
d the program? And how can I know what lock are there in threads caused the deadlock? Thanks. Victor Lin. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to call python from a foreign language thread (C++)

2009-02-03 Thread Victor Lin
On 2月4日, 上午2時44分, Philip Semanchuk wrote: > On Feb 3, 2009, at 12:51 PM, Victor Lin wrote: > > > > > It seems that my program can't call to Python's function from thread > > directly, because there is Global Interpreter Lock. The python's GIL > > is

How to call python from a foreign language thread (C++)

2009-02-03 Thread Victor Lin
void operator() (double time, const AudioData &data) { // acquire lock m_Function(time, data); // release lock } Thanks. Victor Lin. -- http://mail.python.org/mailman/listinfo/python-list

Re: sys.maxint in Python 2.6.1 (amd64) on Windows XP x64

2008-12-16 Thread Lin
ong is at least 32 bit but usually > sizeof(ptr). > Ah, this makes sense. Thanks.. The main reason I'm trying 64-bit Python is that I want to write files bigger than 4GB. This should work on Windows x64, right? (i.e., are the pointers bona fide 64 bit?) -lin -- http://mail.python.org/mailman/listinfo/python-list

sys.maxint in Python 2.6.1 (amd64) on Windows XP x64

2008-12-16 Thread Lin
installation problem? Thank you very much! --lin -- http://mail.python.org/mailman/listinfo/python-list

Logging library unicode problem

2008-08-13 Thread Victor Lin
be considered as a bug? If it is, how to report this bug? Is my solution correct? Are there any side effect will caused by doing so? If the code I write is fine, and solve that problem, how to report it to Python's project? I think this could be helpful for people who also encountered this problem. Thanks. Victor Lin. -- http://mail.python.org/mailman/listinfo/python-list

How to redirect operation methods to some sepcific method easily?

2008-08-03 Thread Victor Lin
Hi, I'd like to write some class that can help me build reusable formula easily, some simple code like this. # -*- coding: utf8 -*- class OperationResult: def __init__(self, left, right): self.dataSource = dataSource def __add__(self, other): self.dataSource.stack.append(

Problem with import

2008-02-11 Thread Victor Lin
m: If I move my directory, I have to modify the path again. This is not a library, they are some programs to do specific task. I think they should be executable in every where I move or copy the directory to. Victor Lin. -- http://mail.python.org/mailman/listinfo/python-list

Re: Recursion limit of pickle?

2008-02-09 Thread Victor Lin
On 2月10日, 上午11時42分, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Sat, 09 Feb 2008 09:49:46 -0200, Victor Lin <[EMAIL PROTECTED]> > escribi�: > > > I encounter a problem with pickle. > > I download a html from: > > >http://www.amazon

Recursion limit of pickle?

2008-02-09 Thread Victor Lin
t stop running program without any message. I think it is also implement with recursion way, and it also over flow stack when dumping soup. Are there any version of pickle that implement with no-recursion way? Thanks. Victor Lin. -- http://mail.python.org/mailman/listinfo/python-list

Strange sqlite3 library behavior

2008-02-02 Thread Victor Lin
data would just keep in memory and discarded with the program's ending. Why sqlite3 just keep inserted data in memory? And how to force inserted data into file? Thanks. Victor Lin. -- http://mail.python.org/mailman/listinfo/python-list

py-cocoa?

2005-12-31 Thread Lin-Chieh Shangkuan
It's known that combining GTK+ or Qt with Python could enable the GUI design with pygtk/pyqt. In Mac OSX, it's suggested that use Cocoa be the GUI framework. Is there py-cocoa framework? -- http://mail.python.org/mailman/listinfo/python-list

Re: Unbinding multiple variables

2005-01-24 Thread Johnny Lin
thanks again for all the help! especially the advice on ideas of tracking down the memory leak :). (sorry for not mentioning it earlier...i had thought deleting everything might be a quick and dirty way short-term fix. :P) best, -Johnny -- http://mail.python.org/mailman/listinfo/python-list

Re: Unbinding multiple variables

2005-01-21 Thread Johnny Lin
thanks everyone for the replies! John Hunter, yep, this is Johnny Lin in geosci :). re using return: the problem i have is somewhere in my code there's a memory leak. i realize return is supposed to unbind all the local variables, but since the memory leak is happening despite retu

Unbinding multiple variables

2005-01-20 Thread Johnny Lin
Hi! Is there a way to automate the unbinding of multiple variables? Say I have a list of the names of all variables in the current scope via dir(). Is there a command using del or something like that that will iterate the list and unbind each of the variables? Thanks much! (If anyone posts an

Python setup question

2005-01-11 Thread Robert Lin
Hi, Sorry for this newbie question, I was wondering if anyone knows why when I run the test, the "test_anydbm" test will seg fault and the tests "test_aepack" and "test_al" are skipped? Thanks in advance. ______   Robert