Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Flask send_from_director throws an exception

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Recently, during the product development of a factory, the send_from_directory API in Flask was called. The calling method is as follows:

Send_from_directory (dirpath, filename, as_attachment = false)

When it runs, the result does not live up to expectations, and an exception is thrown at this point of execution.

Resolution process:

Verify that the parameters of dirpath and filename are correct and the contents of the file are normal.

Write an offline test case, call the same parameters, execute the test case, and the return value is as expected. . What to do:.; is the output using the problem? update the clean output; the return value of the new output interface is as expected; the difference between the new output and the old output is that the output contains the pyc file during debugging; clean up the pyc file in the old output, re-execute it, and the interface call is normal.

Summary:

Make sure the site is clean before debugging.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report