Python Forum
FileNotFoundError: [Errno 2] No such file or directory
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
FileNotFoundError: [Errno 2] No such file or directory
#18
ive added

fp = open(original_path, 'rb', encoding='utf-8')

error
'C:\\Users\\user\\Documents\\RaspberryPi-Noticeboard-master\\WeatherIcons\\clear-day.png'
Traceback (most recent call last):
File "C:\Users\user\Documents\hi.py", line 306, in <module>
window.resize_icons()
File "C:\Users\user\Documents\hi.py", line 285, in resize_icons
fp = open(original_path, 'rb', encoding='utf-8')
ValueError: binary mode doesn't take an encoding argument
>>>

and tried this

fp = open(original_path, 'rb')


error

'C:\\Users\\user\\Documents\\RaspberryPi-Noticeboard-master\\WeatherIcons\\clear-day.png'
Traceback (most recent call last):
File "C:\Users\user\Documents\hi.py", line 306, in <module>
window.resize_icons()
File "C:\Users\user\Documents\hi.py", line 293, in resize_icons
img = PIL.Image.open(fp)
File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\PIL\Image.py", line 2818, in open
prefix = fp.read(16)
File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 146: character maps to <undefined>
>>>

Here's the link to the code it's all at the bottom of the page and also the folder with the images is there too.maybe you can fix it
https://maker.pro/raspberry-pi/projects/...en-display
Reply


Messages In This Thread
RE: FileNotFoundError: [Errno 2] No such file or directory - by saqib1066 - Mar-16-2020, 01:32 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Error (Errno 2), File upload with the Flask framework and a public IP Username_Python1 0 313 Mar-28-2024, 01:46 PM
Last Post: Username_Python1
  FileNotFoundError: [WinError 2] The system cannot find the file specified NewBiee 2 1,630 Jul-31-2023, 11:42 AM
Last Post: deanhystad
  Using pyinstaller with .ui GUI files - No such file or directory error diver999 3 3,515 Jun-27-2023, 01:17 PM
Last Post: diver999
  Extract file only (without a directory it is in) from ZIPIP tester_V 1 1,040 Jan-23-2023, 04:56 AM
Last Post: deanhystad
Thumbs Up Need to compare the Excel file name with a directory text file. veeran1991 1 1,160 Dec-15-2022, 04:32 PM
Last Post: Larz60+
  no such file or directory in SFTP saisankalpj 2 1,609 Nov-25-2022, 11:07 AM
Last Post: DeaD_EyE
Photo Making Zip file of a file and Directory Nasir 2 1,060 Oct-07-2022, 02:01 PM
Last Post: Nasir
  Failed to execute child process (No such file or directory) uriel 1 1,681 Sep-15-2022, 03:48 PM
Last Post: Gribouillis
  Need Help: FileNotFoundError:[Errno 2] No such file or directory python202209 5 2,721 Sep-12-2022, 04:50 AM
Last Post: python202209
  importing functions from a separate python file in a separate directory Scordomaniac 3 1,407 May-17-2022, 07:49 AM
Last Post: Pedroski55

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020