0

im working on a mtg auto sorter and some of the cards have interesting names that python seems to not want to find. i am looking for a file (that i know i have in the right spot) called 8_JÃtun_Grunt.png. using this...

for card_name in card_names:
        # Fetch the image - name can be found based on the card's information
        card_info['name'] = card_name
        img_name = '%s/card_img/png/%s/%s_%s.png' % (Config.data_dir, card_info['set'],
                                                     card_info['collector_number'],
                                                     fetch_data.get_valid_filename(card_info['name']))
        card_img = cv2.imread(img_name)

        # If the image doesn't exist, download it from the URL
        if card_img is None:
            fetch_data.fetch_card_image(card_info,
                                        out_dir='%s/card_img/png/%s' % (Config.data_dir, card_info['set']))
            card_img = cv2.imread(img_name)
        if card_img is None:
            print('WARNING: card %s is not found!' % img_name)

the error i get is so error from cmd

this leads me to think that it cant recognize the file name but im reading it from a database that i cant change. any ideas.

iac009
  • 1

1 Answers1

0

I wouldn't be surprised if OpenCV couldn't handle filepaths with unicode caracters.

you could try to add the code from the answer of this SO question

0xd34dc0de
  • 493
  • 4
  • 10