AttributeError: ‘Typed’ object has no attribute ‘to_tree’

While saving an excel file got via file upload in a html file through flask,

Code:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>from flask import *
import xlsxwriter as xw
import xlwings as xwi
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/submit', methods = ['POST'])
def submit():
if 'f1' in request.files:
f1 = load_workbook(request.files['f1'], data_only=True, read_only=False, keep_vba=True, rich_text=True)
f1.save('output.xlsx')
</code>
<code>from flask import * import xlsxwriter as xw import xlwings as xwi app = Flask(__name__) @app.route('/') def index(): return render_template('index.html') @app.route('/submit', methods = ['POST']) def submit(): if 'f1' in request.files: f1 = load_workbook(request.files['f1'], data_only=True, read_only=False, keep_vba=True, rich_text=True) f1.save('output.xlsx') </code>
from flask import *
import xlsxwriter as xw
import xlwings as xwi

app = Flask(__name__)

@app.route('/')
def index():
    return render_template('index.html')

@app.route('/submit', methods = ['POST'])
def submit():
    if 'f1' in request.files:
        f1 = load_workbook(request.files['f1'], data_only=True, read_only=False, keep_vba=True, rich_text=True)
            
    f1.save('output.xlsx')

Since the error was showing on charts, I tried deleting the existing charts and saving the excel workbook. still the error is same.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>from flask import *
import xlsxwriter as xw
import xlwings as xwi
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/submit', methods = ['POST'])
def submit():
if 'f1' in request.files:
f1 = load_workbook(request.files['f1'], data_only=True, read_only=False, keep_vba=True, rich_text=True)
for sheet in f1.worksheets:
for num, chart in enumerate(sheet._charts):
del sheet._charts[num]
f1.save('output.xlsx')
</code>
<code>from flask import * import xlsxwriter as xw import xlwings as xwi app = Flask(__name__) @app.route('/') def index(): return render_template('index.html') @app.route('/submit', methods = ['POST']) def submit(): if 'f1' in request.files: f1 = load_workbook(request.files['f1'], data_only=True, read_only=False, keep_vba=True, rich_text=True) for sheet in f1.worksheets: for num, chart in enumerate(sheet._charts): del sheet._charts[num] f1.save('output.xlsx') </code>
from flask import *
import xlsxwriter as xw
import xlwings as xwi

app = Flask(__name__)

@app.route('/')
def index():
    return render_template('index.html')

@app.route('/submit', methods = ['POST'])
def submit():
    if 'f1' in request.files:
        f1 = load_workbook(request.files['f1'], data_only=True, read_only=False, keep_vba=True, rich_text=True)
    for sheet in f1.worksheets:
        for num, chart in enumerate(sheet._charts):
            del sheet._charts[num]
            
    f1.save('output.xlsx')

I got the following error:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>File "C:Anaconda3Libsite-packagesflaskapp.py", line 2464, in __call__
return self.wsgi_app(environ, start_response)
File "C:Anaconda3Libsite-packagesflaskapp.py", line 2450, in wsgi_app
response = self.handle_exception(e)
File "C:Anaconda3Libsite-packagesflaskapp.py", line 1867, in handle_exception
reraise(exc_type, exc_value, tb)
File "C:Anaconda3Libsite-packagesflask_compat.py", line 39, in reraise
raise value
File "C:Anaconda3Libsite-packagesflaskapp.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "C:Anaconda3Libsite-packagesflaskapp.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:Anaconda3Libsite-packagesflaskapp.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:Anaconda3Libsite-packagesflask_compat.py", line 39, in reraise
raise value
File "C:Anaconda3Libsite-packagesflaskapp.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "C:Anaconda3Libsite-packagesflaskapp.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "C:UsersSV21242DesktopexcelAutomatewithFlaskindex.py", line 26, in daily
f1.save('output.xlsx')
File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxlworkbookworkbook.py", line 386, in save
save_workbook(self, filename)
File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxlwriterexcel.py", line 294, in save_workbook
writer.save()
File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxlwriterexcel.py", line 275, in save
self.write_data()
File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxlwriterexcel.py", line 80, in write_data
self._write_charts()
File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxlwriterexcel.py", line 124, in _write_charts
self._archive.writestr(chart.path[1:], tostring(chart._write()))
File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxlchart_chart.py", line 150, in _write
return cs.to_tree()
File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxlchartchartspace.py", line 193, in to_tree
tree = super(ChartSpace, self).to_tree()
File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxldescriptorsserialisable.py", line 154, in to_tree
node = obj.to_tree(child_tag)
File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxldescriptorsserialisable.py", line 154, in to_tree
node = obj.to_tree(child_tag)
File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxlchartplotarea.py", line 135, in to_tree
return super(PlotArea, self).to_tree(tagname)
File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxldescriptorsserialisable.py", line 146, in to_tree
for node in nodes:
File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxldescriptorssequence.py", line 114, in to_tree
el = v.to_tree(namespace=namespace)
File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxlchart_chart.py", line 110, in to_tree
return super(ChartBase, self).to_tree(tagname, idx)
File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxldescriptorsserialisable.py", line 154, in to_tree
node = obj.to_tree(child_tag)
AttributeError: 'Typed' object has no attribute 'to_tree'
</code>
<code>File "C:Anaconda3Libsite-packagesflaskapp.py", line 2464, in __call__ return self.wsgi_app(environ, start_response) File "C:Anaconda3Libsite-packagesflaskapp.py", line 2450, in wsgi_app response = self.handle_exception(e) File "C:Anaconda3Libsite-packagesflaskapp.py", line 1867, in handle_exception reraise(exc_type, exc_value, tb) File "C:Anaconda3Libsite-packagesflask_compat.py", line 39, in reraise raise value File "C:Anaconda3Libsite-packagesflaskapp.py", line 2447, in wsgi_app response = self.full_dispatch_request() File "C:Anaconda3Libsite-packagesflaskapp.py", line 1952, in full_dispatch_request rv = self.handle_user_exception(e) File "C:Anaconda3Libsite-packagesflaskapp.py", line 1821, in handle_user_exception reraise(exc_type, exc_value, tb) File "C:Anaconda3Libsite-packagesflask_compat.py", line 39, in reraise raise value File "C:Anaconda3Libsite-packagesflaskapp.py", line 1950, in full_dispatch_request rv = self.dispatch_request() File "C:Anaconda3Libsite-packagesflaskapp.py", line 1936, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "C:UsersSV21242DesktopexcelAutomatewithFlaskindex.py", line 26, in daily f1.save('output.xlsx') File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxlworkbookworkbook.py", line 386, in save save_workbook(self, filename) File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxlwriterexcel.py", line 294, in save_workbook writer.save() File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxlwriterexcel.py", line 275, in save self.write_data() File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxlwriterexcel.py", line 80, in write_data self._write_charts() File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxlwriterexcel.py", line 124, in _write_charts self._archive.writestr(chart.path[1:], tostring(chart._write())) File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxlchart_chart.py", line 150, in _write return cs.to_tree() File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxlchartchartspace.py", line 193, in to_tree tree = super(ChartSpace, self).to_tree() File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxldescriptorsserialisable.py", line 154, in to_tree node = obj.to_tree(child_tag) File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxldescriptorsserialisable.py", line 154, in to_tree node = obj.to_tree(child_tag) File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxlchartplotarea.py", line 135, in to_tree return super(PlotArea, self).to_tree(tagname) File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxldescriptorsserialisable.py", line 146, in to_tree for node in nodes: File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxldescriptorssequence.py", line 114, in to_tree el = v.to_tree(namespace=namespace) File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxlchart_chart.py", line 110, in to_tree return super(ChartBase, self).to_tree(tagname, idx) File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxldescriptorsserialisable.py", line 154, in to_tree node = obj.to_tree(child_tag) AttributeError: 'Typed' object has no attribute 'to_tree' </code>
File "C:Anaconda3Libsite-packagesflaskapp.py", line 2464, in __call__
return self.wsgi_app(environ, start_response)
File "C:Anaconda3Libsite-packagesflaskapp.py", line 2450, in wsgi_app
response = self.handle_exception(e)
File "C:Anaconda3Libsite-packagesflaskapp.py", line 1867, in handle_exception
reraise(exc_type, exc_value, tb)
File "C:Anaconda3Libsite-packagesflask_compat.py", line 39, in reraise
raise value
File "C:Anaconda3Libsite-packagesflaskapp.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "C:Anaconda3Libsite-packagesflaskapp.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:Anaconda3Libsite-packagesflaskapp.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:Anaconda3Libsite-packagesflask_compat.py", line 39, in reraise
raise value
File "C:Anaconda3Libsite-packagesflaskapp.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "C:Anaconda3Libsite-packagesflaskapp.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "C:UsersSV21242DesktopexcelAutomatewithFlaskindex.py", line 26, in daily
f1.save('output.xlsx')
File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxlworkbookworkbook.py", line 386, in save
save_workbook(self, filename)
File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxlwriterexcel.py", line 294, in save_workbook
writer.save()
File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxlwriterexcel.py", line 275, in save
self.write_data()
File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxlwriterexcel.py", line 80, in write_data
self._write_charts()
File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxlwriterexcel.py", line 124, in _write_charts
self._archive.writestr(chart.path[1:], tostring(chart._write()))
File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxlchart_chart.py", line 150, in _write
return cs.to_tree()
File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxlchartchartspace.py", line 193, in to_tree
tree = super(ChartSpace, self).to_tree()
File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxldescriptorsserialisable.py", line 154, in to_tree
node = obj.to_tree(child_tag)
File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxldescriptorsserialisable.py", line 154, in to_tree
node = obj.to_tree(child_tag)
File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxlchartplotarea.py", line 135, in to_tree
return super(PlotArea, self).to_tree(tagname)
File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxldescriptorsserialisable.py", line 146, in to_tree
for node in nodes:
File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxldescriptorssequence.py", line 114, in to_tree
el = v.to_tree(namespace=namespace)
File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxlchart_chart.py", line 110, in to_tree
return super(ChartBase, self).to_tree(tagname, idx)
File "C:Anaconda3libsite-packagesopenpyxl-3.1.4-py3.8.eggopenpyxldescriptorsserialisable.py", line 154, in to_tree
node = obj.to_tree(child_tag)
AttributeError: 'Typed' object has no attribute 'to_tree'

Sad stuff is I couldn’t fine an answer or a related question Stackoverflow or any other websites.

Any help would be greatly helpful

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật