0
votes

I'm trying to use xlwings on mac (10.11.5) with Excel 2016 for Mac (Version 15.23.2), but I get stuck pretty fast.

When I run xlwings runpython install I get the following error:

$ xlwings runpython install
Traceback (most recent call last):
  File "/usr/local/bin/xlwings", line 7, in <module>
    from xlwings.command_line import main
  File "/Library/Python/2.7/site-packages/xlwings/command_line.py", line 22, in <module>
    hfs_to_posix_path(app('Microsoft Excel').properties().get(k.templates_path))))
  File "/Library/Python/2.7/site-packages/aeosa/appscript/reference.py", line 577, in __getattr__
    selectortype, code = self.AS_appdata.referencebyname()[name]
  File "/Library/Python/2.7/site-packages/aeosa/appscript/reference.py", line 259, in referencebyname
    self.connect()
  File "/Library/Python/2.7/site-packages/aeosa/appscript/reference.py", line 225, in connect
    t = self._target = self._aemapplicationclass(**kargs)
  File "/Library/Python/2.7/site-packages/aeosa/aem/__init__.py", line 76, in __init__
    self._address = aemconnect.localapp(path, newinstance, hide)
  File "/Library/Python/2.7/site-packages/aeosa/aem/aemconnect.py", line 187, in localapp
    desc = _launchapplication(path, _runevent, newinstance, hide)
  File "/Library/Python/2.7/site-packages/aeosa/aem/aemconnect.py", line 55, in _launchapplication
    raise CantLaunchApplicationError(err.args[0], path)
aem.aemconnect.CantLaunchApplicationError: Can't launch application at u'/Applications/Microsoft Excel.app': The executable file is missing or has an unusable format. (-10827)

Any ideas on how to proceed?

Versions: Python 2.7.10 xlwings (0.7.2) psutil (4.3.0) appscript (1.0.1)

2
I think the path structure for office on Mac is different from WindowsWombatPM
The problem is solved, it had to do with the user I was trying to run xlwings runpython install as.mccalm

2 Answers

0
votes

Not quite sure yet why it fails, but what xlwings runpython install tries to do, is simply to copy the xlwings.appscript file from the xlwings installation directory into the following directory: ~/Library/Application Scripts/com.microsoft.Excel. Hence to fix the situation, you can just manually copy the file into that directory (create the directory, if it doesn't exist yet). You'll find the path of the xlwings installation by doing:

>>> import xlwings as xw
>>> xw.__path__
0
votes

I found the problem: Basically, I was running xlwings runpython install in a different user-environment than Excel.