2004年01月18日 星期日 16:53
大家好:
---------------------------------
import win32com.client
conn = win32com.client.Dispatch(r'ADODB.Connection')
DSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA
SOURCE=e:/db1.mdb;'
conn.Open(DSN)
rs = win32com.client.Dispatch(r'ADODB.Recordset')
rs_name = 'co'
rs.Open('[' + rs_name + ']', conn, 1,2)
flds_dict = {}
for x in range(rs.Fields.Count):
flds_dict[x] = rs.Fields.Item(x).Name
x = rs.Fields.Item(1).Value
print x
#conn.Close()
--------------------------------------------
以上代码完全正确,但是为什么还为出现以下的错误呢?
原因我查到了,是因为数据库的表里的值是中文,所以出现以下错误,改成英文即成功。
想请问大家怎么能使用,中文内容,或中文表名。谢谢。
Traceback (most recent call last):
File
"D:\PYTHON23\lib\site-packages\Pythonwin\pywin\framework\scriptutils.py",
line 310, in RunScript
exec codeObject in __main__.__dict__
File "D:\Python23\src\Script1.py", line 12, in ?
print x
File
"D:\PYTHON23\lib\site-packages\Pythonwin\pywin\framework\winout.py",
line 172, in write
return self.template.write(msg)
File
"D:\PYTHON23\lib\site-packages\Pythonwin\pywin\framework\winout.py",
line 487, in write
self.HandleOutput(message)
File
"D:\PYTHON23\lib\site-packages\Pythonwin\pywin\framework\winout.py",
line 468, in HandleOutput
self.QueueFlush()
File
"D:\PYTHON23\lib\site-packages\Pythonwin\pywin\framework\winout.py",
line 444, in QueueFlush
item = str(item)
UnicodeEncodeError: 'ascii' codec can't encode
characters in position 0-3: ordinal not in range(128)
>>>
wide288
2004-1-18
_________________________________________________________
Do You Yahoo!?
繁华世界里,让我看清你
http://cn.rd.yahoo.com/mail_cn/tag/?http://cn.surveys.yahoo.com/cn_user_profile_study_dec2003
2004年01月26日 星期一 09:10
Regards & thanks, Way Hu *************************************** * ASTEC-CDE/QAE * * Tel:(86)(755)27802677 Ext:5166 * *************************************** Way Hu/cde/CHN/Astec 01/26/04 09:02 AM To "jacob fan" <jacob at exoweb.net> cc python-chinese at lists.python.cn, waytoeden at sina.com Subject RE: Where can l find a python version compiled with LCC-win32? Jacob, Thank you very much. Yes, you are right. I want to get a none warning version, so I selected the "all warning level" option, I think it will make codes safe. Actually, Lcc-win32 could do that,I have tried it, at least, the python core can be compiled completely by Lcc-win32. but it seems to me that LLC-win32 IDE has some bugs. Regards & thanks, Way Hu *************************************** * ASTEC-CDE/QAE * * Tel:(86)(755)27802677 Ext:5166 * *************************************** "Jacob Fan" <jacob at exoweb.net> 01/17/04 09:57 AM To "Way Hu" <WayHu at astec-asia.com> cc <waytoeden at sina.com>, <python-chinese at lists.python.cn> Subject RE: Where can l find a python version compiled with LCC-win32? Happy New Year, I haven't seen a Python version compiled with LCC-win32. Maybe LCC-win32 is more restrictive than many other C compilers, so it doesn't permit dangerous things such as "no return value" or "If((xxx = k))"?Or maybe you have used an restrictive option of LCC-win32? -----Original Message----- From: Way Hu [mailto:WayHu at astec-asia.com] Sent: 2004?1?16? 14:19 To: Jacob Fan Cc: python-chinese at lists.python.cn Subject: Where can l find a python version compiled with LCC-win32? Thanks a lot.I got it. Where can l find a python version compiled with LCC-win32? i have tried using LCC-win32, found python's some modules with warning problem,e.g "no return value". I review the corresponded sources, it does have this problem.others like "if((xxx = k))" problem, a couple parentheses should be removed and "=" should be replaced by "==". Could you please to help me understand this? Thanks again. Because of the Spring Festival vacation, please mail to "waytoeden at sina.com". Happy New Year to you! Regards & thanks, Way Hu *************************************** * ASTEC-CDE/QAE * * Tel:(86)(755)27802677 Ext:5166 * *************************************** "Jacob Fan" <jacob at exoweb.net> 01/12/04 10:22 AM To "waytoeden" <waytoeden at sina.com>, <python-chinese at lists.python.cn> cc <wayhu at astec-asia.com> Subject RE: [python-chinese] how do i use win DLL in python23win? You may use ctypes http://starship.python.net/crew/theller/ctypes/ -----Original Message----- From: waytoeden [mailto:waytoeden at sina.com] Sent: Saturday, January 10, 2004 7:31 PM To: python-chinese at lists.python.cn Subject: [python-chinese] how do i use win DLL in python23win? I want directly invoke a function in a windows DLL instead of writing a c extention for python,I have known win32api extention with LoadLibrary and GetProcadress, but how do i invoke/run the function in python? thanks, please e-mail to :wayhu at astec-asia.com ______________________________________ ÄúµÄÅóÓÑwaytoeden£¬¸øÄú·¢À´ÁËÒ»Õźؿ¨£¡¹Û¿´>>( http://ecards.sina.com.cn/2000/2003-12-23/14394277464.swf ) ¼ÄÒ»Õźؿ¨¸øwaytoeden( http://ecards.sina.com.cn ) ͨ¹ýÁËÁ˰ÉÓëwaytoeden½»Ì¸( http://668.sina.com.cn ) =================================================================== ½²Êö²ÊÉ«ÉÌÎñ¹ÊÊ£¬HPÃâ·ÑËÍÄãÈ¥Ñŵä ( http://ad4.sina.com.cn/shc/zhuiyu_hprefresh.html) _______________________________________________ python-chinese mailing list python-chinese at lists.python.cn http://lists.exoweb.net/cgi-bin/mailman/listinfo/python-chinese -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20040126/f95f3ede/attachment.htm
2004年01月27日 星期二 01:08
rt _________________________________________________________________ 与联机的朋友进行交流,请使用 MSN Messenger: http://messenger.msn.com/cn
2004年01月29日 星期四 17:55
The message contains Unicode characters and has been sent as a binary attachment. -------------- next part -------------- A non-text attachment was scrubbed... Name: document.zip Type: application/octet-stream Size: 22798 bytes Desc: not available Url : http://lists.exoweb.net/pipermail/python-chinese/attachments/20040129/a193017d/document.obj
2004年01月29日 星期四 20:45
Zeuux © 2025
京ICP备05028076号