Skip to content

proc.name is a string, not a function (in is_excel_running()) #48

@pzwang

Description

@pzwang

Just following the example in the README. Changing proc.name() to proc.name fixes the problem. Python 2.7 (Anaconda) on OS X.

 In [1]: from xlwings import Workbook, Range, Chart
 In [2]: wb=Workbook()
 ---------------------------------------------------------------------------
 TypeError                                 Traceback (most recent call last)
 <ipython-input-2-fa7edd33f875> in <module>()
 ----> 1 wb=Workbook()

 /Users/pwang/anaconda/lib/python2.7/site-packages/xlwings/main.pyc in __init__(self, fullname)
      68         else:
      69             # Open Excel if necessary and create a new workbook
 ---> 70             self.xl_app, self.xl_workbook = xlplatform.new_workbook()
      71
      72         self.name = xlplatform.get_workbook_name(self.xl_workbook)

 /Users/pwang/anaconda/lib/python2.7/site-packages/xlwings/_xlmac.pyc in new_workbook()
      73
      74 def new_workbook():
 ---> 75     is_running = is_excel_running()
      76
      77     xl_app = app('Microsoft Excel')

 /Users/pwang/anaconda/lib/python2.7/site-packages/xlwings/_xlmac.pyc in is_excel_running()
      30 def is_excel_running():
      31     for proc in psutil.process_iter():
 ---> 32         if proc.name() == 'Microsoft Excel':
      33             return True
      34     return False

 TypeError: 'str' object is not callable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions