0

尝试使用 xlwings 时出现 python 错误。仅仅导入 xlwings 似乎就足以触发问题。

Lewis-MacBook-Air:~ lewis$ python
Python 2.7.10 |Anaconda 2.3.0 (x86_64)| (default, Oct 19 2015, 18:31:17) 
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import xlwings
>>> xlwings.__version__
'0.6.0'
>>> exit()
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/Users/lewis/anaconda/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/Users/lewis/anaconda/lib/python2.7/site-packages/xlwings/_xlmac.py", line 47, in clean_up
    if is_excel_running():
  File "/Users/lewis/anaconda/lib/python2.7/site-packages/xlwings/_xlmac.py", line 98, in is_excel_running
    if proc.name() == 'Microsoft Excel':
  File "/Users/lewis/anaconda/lib/python2.7/site-packages/psutil/__init__.py", line 539, in name
    cmdline = self.cmdline()
  File "/Users/lewis/anaconda/lib/python2.7/site-packages/psutil/__init__.py", line 592, in cmdline
    return self._proc.cmdline()
  File "/Users/lewis/anaconda/lib/python2.7/site-packages/psutil/_psosx.py", line 209, in wrapper
    raise ZombieProcess(self.pid, self._name, self._ppid)
ZombieProcess: psutil.ZombieProcess process still exists but it's a zombie (pid=71)
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/Users/lewis/anaconda/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/Users/lewis/anaconda/lib/python2.7/site-packages/xlwings/_xlmac.py", line 47, in clean_up
    if is_excel_running():
  File "/Users/lewis/anaconda/lib/python2.7/site-packages/xlwings/_xlmac.py", line 98, in is_excel_running
    if proc.name() == 'Microsoft Excel':
  File "/Users/lewis/anaconda/lib/python2.7/site-packages/psutil/__init__.py", line 539, in name
    cmdline = self.cmdline()
  File "/Users/lewis/anaconda/lib/python2.7/site-packages/psutil/__init__.py", line 592, in cmdline
    return self._proc.cmdline()
  File "/Users/lewis/anaconda/lib/python2.7/site-packages/psutil/_psosx.py", line 209, in wrapper
    raise ZombieProcess(self.pid, self._name, self._ppid)
psutil.ZombieProcess: psutil.ZombieProcess process still exists but it's a zombie (pid=71)
Lewis-MacBook-Air:~ lewis$ 

使用 Workbook.caller() 从 Excel 调用 python 工作正常。

我正在运行 El Capitan 10.11.2(Beta 5)。

任何建议表示赞赏。

4

1 回答 1

0

似乎是 的版本3.3.0导致了这种情况,如此psutil处所记录。

目前,降级到pip install psutil==3.2.2应该会有所帮助,直到这个问题得到解决。

更新:这已在 v0.6.1 中修复

于 2015-12-04T09:45:12.843 回答