Skip to content

Save no longer allows non-Excel formats in version 0.23.1 #1569

Description

@FERNLEAduglee

Windows 10 Enterprise 64-bit

Python 3.7.4
xlwings 0.23.1
Excel 2019

Prior to version 0.23.1, I could save a book in alternate formats, such as '.txt' just by specifiying the appropriate filename/extention. That now gives a "KeyError: '.txt'" This was working perfectly until I updated to 0.23.1.

Sample Code:
activeBook = books('DL2SALES.XLS')
activeBook.save(path + fileName+'.txt')

Traceback:
File "c:/Users/dougl/Documents/Python/Fernlea/Costing Data to Excel/Main21.py", line 513, in
if Flags['Items']: performProcess(ProcessList, 'Item Master')
File "c:/Users/dougl/Documents/Python/Fernlea/Costing Data to Excel/Main21.py", line 162, in performProcess
saveExcelFile(currentAction[1], basePath, basePath1)
File "c:/Users/dougl/Documents/Python/Fernlea/Costing Data to Excel/Main21.py", line 420, in saveExcelFile
activeBook.save(path + fileName+'.txt')
File "C:\Program Files\Python37\lib\site-packages\xlwings\main.py", line 740, in save
self.impl.save(path)
File "C:\Program Files\Python37\lib\site-packages\xlwings_xlwindows.py", line 533, in save
file_format = ext_to_file_format[target_ext]
KeyError: '.txt'

EDIT: downgrading to 0.22.3 has eliminated the issue.

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