Python论坛  - 讨论区

标题:[python-chinese] sqlobject vs mysql的utf8问题

2007年05月15日 星期二 18:55

ro rosettas在gmail.com
星期二 五月 15 18:55:11 HKT 2007

hi all

谁跑通过吗,我的utf8提交查询出错.用google到的办法改dburi也不行

-- 
with kind regards

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年05月17日 星期四 12:01

miaozhaozhao20 miaozhaozhao200在163.com
星期四 五月 17 12:01:26 HKT 2007

 能详细些吗?我的在Turbogears中用Sqlobject与Mysql5,使用utf8没有问题的。  
在2007-05-15,ro <rosettas at gmail.com> 写道:
hi all 谁跑通过吗,我的utf8提交查询出错.用google到的办法改dburi也不行 -- with kind regards _______________________________________________ python-chinese Post: send python-chinese at lists.python.cn Subscribe: send subscribe to python-chinese-request at lists.python.cn Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn Detail Info: http://python.cn/mailman/listinfo/python-chinese
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://python.cn/pipermail/python-chinese/attachments/20070517/51b5b04a/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年05月17日 星期四 12:32

李鹏 jeffskylee在163.com
星期四 五月 17 12:32:33 HKT 2007

´ó¼ÒºÃ£¬ÄúºÃ£¡ 

     Çë½ÌÒ»¸öÎÊÌâ¡£

    ÏÖÔÚÖ¸¶¨ÁËÒ»¸öÎļþµÄ¾ø¶ÔµØÖ·£¬ÔõÑùʹÓÃpythonµ÷ÓøÃÎļþ¶ÔÓ¦µÄ¡°Ä¬ÈÏ´ò¿ª³ÌÐò¡±´ò¿ªËü£¿

   ±ÈÈçÖ¸¶¨ÁËÒ»¸ö111.txt£¬python¾Í»áµ÷¼Çʱ¾´ò¿ªËü¡£Ö¸¶¨µÄÊÇ111.doc£¬Ôòµ÷ÓÃword´ò¿ªËü£¿

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡³Ùµ½Õß
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡jeffskylee在163.com
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2007-05-17
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070517/dbddd668/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年05月17日 星期四 12:42

limodou limodou在gmail.com
星期四 五月 17 12:42:20 HKT 2007

On 5/17/07, 李鹏 <jeffskylee在163.com> wrote:
>
> 大家好,您好!
>
>      请教一个问题。
>
>     现在指定了一个文件的绝对地址,怎样使用python调用该文件对应的"默认打开程序"打开它?
>
>    比如指定了一个111.txt,python就会调记事本打开它。指定的是111.doc,则调用word打开它?
>

os.startfile(path)

Start a file with its associated application. This acts like
double-clicking the file in Windows Explorer, or giving the file name
as an argument to the start command from the interactive command
shell: the file is opened with whatever application (if any) its
extension is associated.
startfile() returns as soon as the associated application is launched.
There is no option to wait for the application to close, and no way to
retrieve the application's exit status. The path parameter is relative
to the current directory. If you want to use an absolute path, make
sure the first character is not a slash ("/"); the underlying Win32
ShellExecute() function doesn't work if it is. Use the
os.path.normpath() function to ensure that the path is properly
encoded for Win32. Availability: Windows. New in version 2.0.



-- 
I like python!
UliPad <>: http://wiki.woodpecker.org.cn/moin/UliPad
My Blog: http://www.donews.net/limodou

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年05月17日 星期四 12:46

头太晕 torrycn在gmail.com
星期四 五月 17 12:46:12 HKT 2007

>>> import os
>>> os.popen('d:\\11.doc')


ÔÚ07-5-17£¬ÀîÅô <jeffskylee在163.com> дµÀ£º
>
> ´ó¼ÒºÃ£¬ÄúºÃ£¡
>      Çë½ÌÒ»¸öÎÊÌâ¡£
>
>     ÏÖÔÚÖ¸¶¨ÁËÒ»¸öÎļþµÄ¾ø¶ÔµØÖ·£¬ÔõÑùʹÓÃpythonµ÷ÓøÃÎļþ¶ÔÓ¦µÄ"ĬÈÏ´ò¿ª³ÌÐò"´ò¿ªËü£¿
>
>    ±ÈÈçÖ¸¶¨ÁËÒ»¸ö111.txt£¬python¾Í»áµ÷¼Çʱ¾´ò¿ªËü¡£Ö¸¶¨µÄÊÇ111.doc£¬Ôòµ÷ÓÃword´ò¿ªËü£¿
>
>  ³Ùµ½Õß
>  jeffskylee在163.com
>  2007-05-17
>
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070517/25c4c1ec/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年05月17日 星期四 12:47

ro rosettas在gmail.com
星期四 五月 17 12:47:46 HKT 2007

On 5/17/07, miaozhaozhao20 <miaozhaozhao200在163.com> wrote:
>
> 能详细些吗?我的在Turbogears中用Sqlobject与Mysql5,使用utf8没有问题的。
>

我也是用turbogears
While I use sqlobject to commit UTF8 string to MySQL, this error caused

 File "d:\python24\lib\site-packages\SQLObject-0.7.5-py2.4.egg\sqlobject\mysql\mysqlconnection.py",
line 77, in _executeRetry
 myquery = unicode(query, self.encoding)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position
111: ordinal not in range(128)

你用的数据库连接字符串怎么写的

-- 
with
> kind
> regards
_______________________________________________
python-chinese
Post:
> send python-chinese在lists.python.cn
Subscribe: send subscribe to
> python-chinese-request在lists.python.cn
Unsubscribe: send
> unsubscribe to
> python-chinese-request在lists.python.cn
Detail Info:
> http://python.cn/mailman/listinfo/python-chinese
>
>
> ________________________________
> 免费试玩2006中国最佳网络游戏--梦幻西游
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to
> python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to
> python-chinese-request在lists.python.cn
> Detail Info:
> http://python.cn/mailman/listinfo/python-chinese
>


-- 
with kind regards

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年05月17日 星期四 12:50

miaozhaozhao20 miaozhaozhao200在163.com
星期四 五月 17 12:50:51 HKT 2007

我有篇博客不知道能不能解决你的问题http://blog.chinaunix.net/u/13637/showart_278320.html再交流  
在2007-05-17,ro <rosettas at gmail.com> 写道:
On 5/17/07, miaozhaozhao20 <miaozhaozhao200 at 163.com> wrote: > > 能详细些吗?我的在Turbogears中用Sqlobject与Mysql5,使用utf8没有问题的。 > 我也是用turbogears While I use sqlobject to commit UTF8 string to MySQL, this error caused File "d:\python24\lib\site-packages\SQLObject-0.7.5-py2.4.egg\sqlobject\mysql\mysqlconnection.py", line 77, in _executeRetry myquery = unicode(query, self.encoding) UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 111: ordinal not in range(128) 你用的数据库连接字符串怎么写的 -- with > kind > regards _______________________________________________ python-chinese Post: > send python-chinese at lists.python.cn Subscribe: send subscribe to > python-chinese-request at lists.python.cn Unsubscribe: send > unsubscribe to > python-chinese-request at lists.python.cn Detail Info: > http://python.cn/mailman/listinfo/python-chinese > > > ________________________________ > 免费试玩2006中国最佳网络游戏--梦幻西游 > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to > python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to > python-chinese-request at lists.python.cn > Detail Info: > http://python.cn/mailman/listinfo/python-chinese > -- with kind regards _______________________________________________ python-chinese Post: send python-chinese at lists.python.cn Subscribe: send subscribe to python-chinese-request at lists.python.cn Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn Detail Info: http://python.cn/mailman/listinfo/python-chinese
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://python.cn/pipermail/python-chinese/attachments/20070517/23b21402/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年05月17日 星期四 14:07

李鹏 jeffskylee在163.com
星期四 五月 17 14:07:54 HKT 2007

limodou,您好!

	谢谢你,竟然这么简单

======= 2007-05-17 12:42:26 您在来信中写道:=======

>On 5/17/07, 李鹏 <jeffskylee在163.com> wrote:
>>
>> 大家好,您好!
>>
>>      请教一个问题。
>>
>>     现在指定了一个文件的绝对地址,怎样使用python调用该文件对应的"默认打开程序"打开它?
>>
>>    比如指定了一个111.txt,python就会调记事本打开它。指定的是111.doc,则调用word打开它?
>>
>
>os.startfile(path)
>
>Start a file with its associated application. This acts like
>double-clicking the file in Windows Explorer, or giving the file name
>as an argument to the start command from the interactive command
>shell: the file is opened with whatever application (if any) its
>extension is associated.
>startfile() returns as soon as the associated application is launched.
>There is no option to wait for the application to close, and no way to
>retrieve the application's exit status. The path parameter is relative
>to the current directory. If you want to use an absolute path, make
>sure the first character is not a slash ("/"); the underlying Win32
>ShellExecute() function doesn't work if it is. Use the
>os.path.normpath() function to ensure that the path is properly
>encoded for Win32. Availability: Windows. New in version 2.0.
>
>
>
>-- 
>I like python!
>UliPad <>: http://wiki.woodpecker.org.cn/moin/UliPad
>My Blog: http://www.donews.net/limodou
>_______________________________________________
>python-chinese
>Post: send python-chinese在lists.python.cn
>Subscribe: send subscribe to python-chinese-request在lists.python.cn
>Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
>Detail Info: http://python.cn/mailman/listinfo/python-chinese

= = = = = = = = = = = = = = = = = = = =
			

        致
礼!
 
				 
        李鹏
        jeffskylee在163.com
          2007-05-17


[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年05月17日 星期四 16:24

ro rosettas在gmail.com
星期四 五月 17 16:24:09 HKT 2007

On 5/17/07, miaozhaozhao20 <miaozhaozhao200在163.com> wrote:
> 我有篇博客不知道能不能解决你的问题
> http://blog.chinaunix.net/u/13637/showart_278320.html
> 再交流
>

谢谢,我想你的解决方式是可以的
我根据在sqlobject mail list上得到的建议解决了,只加sqlobject_encoding
=utf-8&charset;=utf8这两个参数即可

-- 
with kind regards

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年05月17日 星期四 17:35

miaozhaozhao20 miaozhaozhao200在163.com
星期四 五月 17 17:35:32 HKT 2007

呵呵!共同学习!    
在2007-05-17,ro <rosettas at gmail.com> 写道:
On 5/17/07, miaozhaozhao20 <miaozhaozhao200 at 163.com> wrote: > 我有篇博客不知道能不能解决你的问题 > http://blog.chinaunix.net/u/13637/showart_278320.html > 再交流 > 谢谢,我想你的解决方式是可以的 我根据在sqlobject mail list上得到的建议解决了,只加sqlobject_encoding =utf-8&charset;=utf8这两个参数即可 -- with kind regards _______________________________________________ python-chinese Post: send python-chinese at lists.python.cn Subscribe: send subscribe to python-chinese-request at lists.python.cn Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn Detail Info: http://python.cn/mailman/listinfo/python-chinese
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://python.cn/pipermail/python-chinese/attachments/20070517/39c92fad/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号