Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
ipython 怎么粘贴中文目录
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  9 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Jiahua Huang  
View profile  
 More options Nov 28 2007, 12:34 am
From: "Jiahua Huang" <jhuangjia...@gmail.com>
Date: Wed, 28 Nov 2007 13:34:18 +0800
Local: Wed, Nov 28 2007 12:34 am
Subject: Re: [python-chinese] ipython 怎么粘贴中文目录

在  IPython/__init__.py 还需要改
import sys
reload(sys)
sys.setdefaultencoding(sys.stdin.encoding)

我的补丁是

diff -ruNp ipython-0.8.1.orig/IPython/__init__.py
ipython-0.8.1/IPython/__init__.py
--- ipython-0.8.1.orig/IPython/__init__.py      2007-05-05
04:01:13.000000000 +0800
+++ ipython-0.8.1/IPython/__init__.py   2007-11-28 13:29:46.000000000 +0800
@@ -38,6 +38,8 @@ $Id: __init__.py 1854 2006-10-30 19:54:2

 # Enforce proper version requirements
 import sys
+reload(sys)
+sys.setdefaultencoding(sys.stdin.encoding)

 if sys.version[0:3] < '2.3':
     raise ImportError('Python Version 2.3 or above is required for IPython.')
diff -ruNp ipython-0.8.1.orig/IPython/iplib.py ipython-0.8.1/IPython/iplib.py
--- ipython-0.8.1.orig/IPython/iplib.py 2007-05-05 04:01:13.000000000 +0800
+++ ipython-0.8.1/IPython/iplib.py      2007-11-28 13:30:42.000000000 +0800
@@ -1884,7 +1884,7 @@ want to merge them back into the new fil
             source = 'if 1:\n%s' % source

         try:
-            code = self.compile(source,filename,symbol)
+            code =
self.compile(source.encode(sys.stdout.encoding),filename,symbol)
         except (OverflowError, SyntaxError, ValueError):
             # Case 1
             self.showsyntaxerror(filename)

On Nov 27, 2007 8:19 PM, pan <nirvana...@gmail.com> wrote:

  ipython-zh.diff
1K Download

_______________________________________________
python-chinese
Post: send python-chin...@lists.python.cn
Subscribe: send subscribe to python-chinese-requ...@lists.python.cn
Unsubscribe: send unsubscribe to  python-chinese-requ...@lists.python.cn
Detail Info: http://python.cn/mailman/listinfo/python-chinese


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jiahua Huang  
View profile  
 More options Nov 28 2007, 12:38 am
From: "Jiahua Huang" <jhuangjia...@gmail.com>
Date: Wed, 28 Nov 2007 13:38:00 +0800
Subject: Re: [python-chinese] ipython 怎么粘贴中文目录

如果不修改 sys.setdefaultencoding 的话,
我这里会出错,见 http://paste.ubuntu.org.cn/4186

$ ipython
Python 2.5.1 (r251:54863, Oct  5 2007, 13:36:32)
Type "copyright", "credits" or "license" for more information.

IPython 0.8.1 -- An enhanced Interactive Python.
?       -> Introduction to IPython's features.
%magic  -> Information about IPython's 'magic' % functions.
help    -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

In [1]: cd 离歌
---------------------------------------------------------------------------
<type 'exceptions.UnicodeEncodeError'>    Traceback (most recent call last)

/var/lib/python-support/python2.5/IPython/iplib.py in
multiline_prefilter(self, line, continue_prompt)
   2282         out = []
   2283         for l in line.rstrip('\n').split('\n'):
-> 2284             out.append(self._prefilter(l, continue_prompt))
   2285         return '\n'.join(out)
   2286

/var/lib/python-support/python2.5/IPython/iplib.py in _prefilter(self,
line, continue_prompt)
   2197                        (self.rc.multi_line_specials or not
continue_prompt):
   2198                     return self.handle_magic(line,continue_prompt,
-> 2199                                              pre,iFun,theRest)
   2200                 else:
   2201                     return self.handle_normal(line,continue_prompt)

/var/lib/python-support/python2.5/IPython/iplib.py in
handle_magic(self, line, continue_prompt, pre, iFun, theRest)
   2345
   2346
-> 2347         cmd = '%s_ip.magic(%s)' % (pre,make_quoted_expr(iFun +
" " + theRest))
   2348         self.log(line,cmd,continue_prompt)
   2349         #print 'in handle_magic, cmd=<%s>' % cmd  # dbg

/var/lib/python-support/python2.5/IPython/genutils.py in make_quoted_expr(s)
    985         # give up, backslash-escaped string will do
    986         return '"%s"' % esc_quotes(s)
--> 987     res = itpl("$raw$quote$s$tailpadding$quote$tail")
    988     return res
    989

/var/lib/python-support/python2.5/IPython/Itpl.py in itpl(text)
    250
    251 # utilities for fast printing
--> 252 def itpl(text): return str(Itpl(text))
    253 def printpl(text): print itpl(text)
    254 # versions with namespace

/var/lib/python-support/python2.5/IPython/Itpl.py in __str__(self)
    216         loc, glob = frame.f_locals, frame.f_globals
    217
--> 218         return self._str(glob,loc)
    219
    220 class ItplNS(Itpl):

/var/lib/python-support/python2.5/IPython/Itpl.py in _str(self, glob, loc)
    199         app = result.append
    200         for live, chunk in self.chunks:
--> 201             if live: app(str(eval(chunk,glob,loc)))
    202             else: app(chunk)
    203         out = ''.join(result)

<type 'exceptions.UnicodeEncodeError'>: 'ascii' codec can't encode
characters in position 3-4: ordinal not in range(128)

In [2]:

On Nov 28, 2007 1:34 PM, Jiahua Huang <jhuangjia...@gmail.com> wrote:

  ipython-zh.diff
1K Download

_______________________________________________
python-chinese
Post: send python-chin...@lists.python.cn
Subscribe: send subscribe to python-chinese-requ...@lists.python.cn
Unsubscribe: send unsubscribe to  python-chinese-requ...@lists.python.cn
Detail Info: http://python.cn/mailman/listinfo/python-chinese


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jiahua Huang  
View profile   Translate to Translated (View Original)
 More options Nov 28 2007, 10:03 pm
From: "Jiahua Huang" <jhuangjia...@gmail.com>
Date: Thu, 29 Nov 2007 11:03:15 +0800
Local: Wed, Nov 28 2007 10:03 pm
Subject: Re: [python-chinese] ipython 怎么粘贴中文目录
不过记得以前 Vista 和 XP 下用 ipython 的时候,中文输入法好像用不了,
只能别处粘贴中文

On Nov 29, 2007 9:11 AM, pan <nirvana...@gmail.com> wrote:

> 但是在windows下不会, 可能是因为用的pyreadline的关系.

_______________________________________________
python-chinese
Post: send python-chin...@lists.python.cn
Subscribe: send subscribe to python-chinese-requ...@lists.python.cn
Unsubscribe: send unsubscribe to  python-chinese-requ...@lists.python.cn
Detail Info: http://python.cn/mailman/listinfo/python-chinese

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jiahua Huang  
View profile   Translate to Translated (View Original)
 More options Nov 28 2007, 10:37 pm
From: "Jiahua Huang" <jhuangjia...@gmail.com>
Date: Thu, 29 Nov 2007 11:37:04 +0800
Local: Wed, Nov 28 2007 10:37 pm
Subject: Re: [python-chinese] ipython 怎么粘贴中文目录
On Nov 29, 2007 11:26 AM, pan <nirvana...@gmail.com> wrote:

> 我用debian测试了下, 的确会出错.

> 发现如果使用setappdefaultencoding, 就不用reload(sys)了,
> 还有就是console的stdout和stdin的encoding应该一直都是一样的, 随便用那个都可以, 这里改成code =
> self.compile(str(source),filename,symbol)就行了.

恩,因为你 Debian 里边是旧版本的 Python 2.3,
Python2.4 以后 sys 里边是没有 sys.setappdefaultencoding 的,
而 import sys 后需要 reload 才有 sys.setdefaultencoding
这个跟木头前辈讨论过。

如果要同时兼容 python2.3- 和 python2.4+
那么得换成
import sys
reload(sys)
try:
    sys.setdefaultencoding(sys.stdin.encoding)
except:
    sys.setappdefaultencoding(sys.stdin.encoding)

> >不过记得以前 Vista 和 XP 下用 ipython 的时候,中文输入法好像用不了,只能别处粘贴中文

> 可能是你用的输入法有问题, 我用的是搜狗的那个输入法.

用默认安装 Windows 的自带输入法

另外,贴修改的时候,似乎用 diff -ruNp 输出的补丁格式会更加容易理解,

--- ipython-0.8.1.orig/IPython/__init__.py      2007-05-05
04:01:13.000000000 +0800
+++ ipython-0.8.1/IPython/__init__.py   2007-11-29 11:36:07.000000000 +0800
@@ -38,6 +38,11 @@ $Id: __init__.py 1854 2006-10-30 19:54:2

 # Enforce proper version requirements
 import sys
+reload(sys)
+try:
+    sys.setdefaultencoding(sys.stdin.encoding)
+except:
+    sys.setappdefaultencoding(sys.stdin.encoding)

 if sys.version[0:3] < '2.3':
     raise ImportError('Python Version 2.3 or above is required for IPython.')
_______________________________________________
python-chinese
Post: send python-chin...@lists.python.cn
Subscribe: send subscribe to python-chinese-requ...@lists.python.cn
Unsubscribe: send unsubscribe to  python-chinese-requ...@lists.python.cn
Detail Info: http://python.cn/mailman/listinfo/python-chinese


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jiahua Huang  
View profile   Translate to Translated (View Original)
 More options Nov 28 2007, 10:40 pm
From: "Jiahua Huang" <jhuangjia...@gmail.com>
Date: Thu, 29 Nov 2007 11:40:34 +0800
Local: Wed, Nov 28 2007 10:40 pm
Subject: Re: [python-chinese] ipython 怎么粘贴中文目录
Windows 下 mingw32 应该就带了 diff、 patch 等工具

On Nov 29, 2007 11:37 AM, Jiahua Huang <jhuangjia...@gmail.com> wrote:

> 另外,贴修改的时候,似乎用 diff -ruNp 输出的补丁格式会更加容易理解,

_______________________________________________
python-chinese
Post: send python-chin...@lists.python.cn
Subscribe: send subscribe to python-chinese-requ...@lists.python.cn
Unsubscribe: send unsubscribe to  python-chinese-requ...@lists.python.cn
Detail Info: http://python.cn/mailman/listinfo/python-chinese

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jiahua Huang  
View profile   Translate to Translated (View Original)
 More options Nov 28 2007, 10:41 pm
From: "Jiahua Huang" <jhuangjia...@gmail.com>
Date: Thu, 29 Nov 2007 11:41:50 +0800
Local: Wed, Nov 28 2007 10:41 pm
Subject: Re: [python-chinese] ipython 怎么粘贴中文目录
这 ipython 下好像一直都不可以吧

On Nov 29, 2007 11:32 AM, pan <nirvana...@gmail.com> wrote:

> 还有就是如果用code = self.compile(str(source),filename,symbol). 在ipython下就不能在像这样s =
> u"得到", 这时s不是unicode, 必须手动unicode才行, 像这样s = unicode("得到").

_______________________________________________
python-chinese
Post: send python-chin...@lists.python.cn
Subscribe: send subscribe to python-chinese-requ...@lists.python.cn
Unsubscribe: send unsubscribe to  python-chinese-requ...@lists.python.cn
Detail Info: http://python.cn/mailman/listinfo/python-chinese

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jiahua Huang  
View profile  
 More options Nov 28 2007, 11:19 pm
From: "Jiahua Huang" <jhuangjia...@gmail.com>
Date: Thu, 29 Nov 2007 12:19:35 +0800
Local: Wed, Nov 28 2007 11:19 pm
Subject: Re: [python-chinese] ipython 怎么粘贴中文目录
增强的 Python 交互界面

huahua@huahua:sf$ apt-cache show  ipython

Package: ipython
Priority: optional
Section: universe/python
Installed-Size: 2544
Maintainer: Ubuntu MOTU Developers <ubuntu-m...@lists.ubuntu.com>
Original-Maintainer: Debian Python Modules Team
<python-modules-t...@lists.alioth.debian.org>
Architecture: all
Version: 0.8.1-1
Replaces: python2.3-ipython, python2.4-ipython, ipython-common
Depends: python, python-support (>= 0.2), python-pexpect
Recommends: python-numeric, python-numeric-ext, python-matplotlib
Suggests: python-profiler
Conflicts: python2.3-ipython, python2.4-ipython, ipython-common
Filename: pool/universe/i/ipython/ipython_0.8.1-1_all.deb
Size: 1047256
MD5sum: dbca77e2abad63a7fe1c2afadd78d29a
SHA1: 3df0f85b4a65603429a2d8fecd279354c0b8b942
SHA256: f35288075d8b71d80bd84fe6a40b479c4509f200234b9b75daf1886f8fdf98b9
Description: enhanced interactive Python shell
 IPython can be used as a replacement for the standard Python shell,
 or it can be used as a complete working environment for scientific
 computing (like Matlab or Mathematica) when paired with the standard
 Python scientific and numerical tools. It supports dynamic object
 introspections, numbered input/output prompts, a macro system,
 session logging, session restoring, complete system shell access,
 verbose and colored traceback reports, auto-parentheses, auto-quoting,
 and is embeddable in other Python programs.
 .
  Homepage: http://ipython.scipy.org/
Bugs: mailto:ubuntu-us...@lists.ubuntu.com
Origin: Ubuntu

On Nov 29, 2007 12:11 PM, 篱笆 <namel...@gmail.com> wrote:

> 路过一下.ipython是什么?

另外, google 甚至 baidu 一下都可以知道的。
_______________________________________________
python-chinese
Post: send python-chin...@lists.python.cn
Subscribe: send subscribe to python-chinese-requ...@lists.python.cn
Unsubscribe: send unsubscribe to  python-chinese-requ...@lists.python.cn
Detail Info: http://python.cn/mailman/listinfo/python-chinese

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jiahua Huang  
View profile   Translate to Translated (View Original)
 More options Nov 28 2007, 11:23 pm
From: "Jiahua Huang" <jhuangjia...@gmail.com>
Date: Thu, 29 Nov 2007 12:23:12 +0800
Local: Wed, Nov 28 2007 11:23 pm
Subject: Re: [python-chinese] ipython 怎么粘贴中文目录
btw:

如果嫌 ipython 碍事,
又喜欢 ipython 的自动补全,
那么可以在 python 交互界面里先执行下
import readline, rlcompleter; readline.parse_and_bind("tab: complete")
就可以跟 bash 下一样按 Tab 自动补全了

不想每次都这样的话,

Ubuntu 和 MAC OS X 下
可以新建个文件  ~/.pythonstartup.py
写入
import readline, rlcompleter; readline.parse_and_bind("tab: complete")

再在 ~/.bashrc
添加一行
export PYTHONSTARTUP=~/.pythonstartup.py

Windows 下估计可以在 这台电脑->属性->高级->环境变量  里边添加
_______________________________________________
python-chinese
Post: send python-chin...@lists.python.cn
Subscribe: send subscribe to python-chinese-requ...@lists.python.cn
Unsubscribe: send unsubscribe to  python-chinese-requ...@lists.python.cn
Detail Info: http://python.cn/mailman/listinfo/python-chinese


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jiahua Huang  
View profile   Translate to Translated (View Original)
 More options Nov 28 2007, 11:25 pm
From: "Jiahua Huang" <jhuangjia...@gmail.com>
Date: Thu, 29 Nov 2007 12:25:04 +0800
Local: Wed, Nov 28 2007 11:25 pm
Subject: Re: [python-chinese] ipython 怎么粘贴中文目录
你贴 svn diff 、 git diff 也可以呀

diff 带有上下文等描述,
比你语言描述要清晰。

On Nov 29, 2007 12:18 PM, pan <nirvana...@gmail.com> wrote:

> 一两行我想就不用diff了把, 还有svn也带了diff的, 用svn diff > d.patch也可以

_______________________________________________
python-chinese
Post: send python-chin...@lists.python.cn
Subscribe: send subscribe to python-chinese-requ...@lists.python.cn
Unsubscribe: send unsubscribe to  python-chinese-requ...@lists.python.cn
Detail Info: http://python.cn/mailman/listinfo/python-chinese

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google