FileNotFoundError: [Errno 2] No such file or directory: 'image/1.jpg' problem
I've been learning reptiles recently , Want to climb some pictures and save them locally , There are various problems when downloading pictures , Let's talk about the problem solved in the end .
( The code will not be pasted out )
In theory , This code works properly , Because I learned from a blogger , Maybe it's because of the permission problem , I tried to change another disk to store and run , But the same result .
Such an error occurs after running :

It means you can't save .
resolvent :
Law 1 :
1. Import os library
2. Copy the path to store , Plus the format of the display
3. use os.path.expanduser() function
4. Find the path correctly
5. The successful running



Law two :
Another way is in your .py Create a separate folder under the file img Save the photos you downloaded

And then use './img/’ Save it in a folder
with open('./img/' + str(count) + '.jpg', mode="wb") as file:
The successful running :


The above is my experience , If there is any deficiency , Welcome to correct .
当前位置:网站首页>FileNotFoundError: [Errno 2] No such file or directory: 'image/1. Jpg 'problem solving
FileNotFoundError: [Errno 2] No such file or directory: 'image/1. Jpg 'problem solving
2022-04-22 23:37:00 【Lorem wanhou】
版权声明
本文为[Lorem wanhou]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204222331551780.html
边栏推荐
- [perseverance challenge] PCIe asks and answers every day (2022.04 in progress)
- [dvcon2020] acceleration of low power design level verification based on signoff abstract model
- visual studio 总是和搜狗输入法冲突
- . net 6 when exiting the constructor, the non nullable property "XXX" must contain a non null value.
- [dvcon2020] software brothers shout: Hardware brothers, please be personal
- MPP架构概念
- [PCIe actual combat] SNPs PCIe enables SRIS mode
- PCIe 参考时钟架构 (Refclk Architecture)
- 你好,我想办理原油期货开户,目前怎么办理期货开户安全靠谱?
- Go timer time Ticker
猜你喜欢

LabVIEW controls computer shutdown, hibernation, logout and restart

(JS) use the properties and methods of the string object to realize the registration and login functions. The length of the user name is required to be in the range of 3-10 and the password is 6-20 ch

邀请你参与字节跳动 UME 插件开发竞赛

线程池(通俗易懂)

【PCIe 6.0】PCIe 6.0 新特性 - DMWr (Deferrable Memory Write) 详解

【毅力挑战】PCIe 每日一问一答(2022.02 归档)

VsCode使用EmmyLua插件调试Unity工程ToLua代码

ESP32 (GPIO)-GPIO学习(5)

PCIe 参考时钟架构 (Refclk Architecture)

Detailed explanation of SQL language
随机推荐
【Turtle表白合集】“海底月是天上月,眼前人是心上人。”余生多喜乐,长平安~(附3款源码)
Excel VBA multi condition screening and summary statistics
Shell script command results are saved to variables with line breaks
[BJDCTF2020]Easy MD5
华为机试题——HJ73 计算日期到天数转换
FileNotFoundError: [Errno 2] No such file or directory: 'image/1.jpg'问题解决
Where is London gold safer to open an account?
Read software engineering at Google (14)
2面技术 HR面 offer,系列篇
浅谈LD_PRELOAD劫持
【超能力】我想暂停时空
Read software engineering at Google (13)
[original] [open source] C WinForm DPI adaptive scheme, sunnyui three-step solution
MySQL索引的语法是什么
[day22] - [linked list] intersecting linked list
2 technical HR offers, series
Vs-写汇编
Software test (1)
[leetcode refers to offer 54. The k-th node of the binary search tree (simple)]
【DVCon2020】基于多线程UVM测试平台的仿真加速方法