I have installed Python Tools for Visual Studio. I have also installed the latest Anaconda package. I'm a .NET developer but have a requirement to do some spreadsheet work with python.
So I develop and run my python code in Visual Studio with the aim being to eventually call it from excel using xlwings
.
I've read about putting in a 'mock caller' so I wrote some code like this
if __name__ == '__main__':
neto = exportcategories_api('Bellbird2')
## Expects the Excel file next to this source file, adjust accordingly.
path = os.path.abspath(os.path.join(os.path.dirname(__file__),
'Export Categories.xlsm'))
xw.Book.set_mock_caller(path)
neto.export()
I have also included:
import xlwings as xw
at the top of my python file. This is underlined with 'unable to resolve'.
and when I run my code nothing happens. The command window pops up but it seems to hang.
If I remove the import xlwings as xw
and comment out my mock caller lines of code, it runs fine.
What have I got wrong?