Python Forum
subprocess FileNotFoundError: [Errno 2] No such file or directory:
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
subprocess FileNotFoundError: [Errno 2] No such file or directory:
#11
Hi again! Sorry to be a pest!

In the function

def load_symbol_table(path: Path):
in your post above:

Quote:line 66: reader = csv.reader(f, delimiter=delimiter)
line 78: reader2 = csv.DictReader(f, delimiter=delimiter)

If I don't import csv I get:

Quote:NameError: name 'csv' is not defined. Did you forget to import 'csv'?

I only changed import csv and OUT_DIR

Like I said above though, I get no error running your programme, but the result is bad, and black on transparent background, no colour at all.

I downloaded some emoji svg files from github. For example this one: emoji_u1f3aa.svg It looks like a circus tent.

If I do this:

symbol_template = "/home/peterr/PVE/emoji2svg2png/emoji_u1f3aa.svg" with open(symbol_template) as t: lines = t.readlines() len(lines) # 62 for line in lines: print(line)
The output is 62 lines and complicated. That, I think, is the reason why the output I get is not good.

If I load an output svg which I got from your programme:

symbol_template = "/home/peterr/PVE/emoji2svg2png/svg/emoji_1F95A_U1F95A.svg" with open(symbol_template) as t: lines = t.readlines() len(lines) # 40 for line in lines: print(line)
The output looks like this:

Output:
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg width="256" height="256" viewBox="0 0 256 256" version="1.1" id="svg6" sodipodi:docname="temp_1F95A_U1F95A.svg" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg"> <defs id="defs10" /> <sodipodi:namedview id="namedview8" pagecolor="#ffffff" bordercolor="#000000" borderopacity="0.25" inkscape:showpageshadow="2" inkscape:pageopacity="0.0" inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1" /> <style id="style2"> @font-face { font-family: CustomEmojiFont; src: url(&quot;Segoe UI Emoji&quot;) format(&quot;truetype&quot;); } text { font-family: CustomEmojiFont, sans-serif; font-size: 204px; dominant-baseline: hanging; } </style> <text x="5" y="50" id="text4">🥚</text> </svg>
Is that what you get?

But I don't see an egg, I just see a black half egg!

I tried using this FONT_PATH:

FONT_PATH = '/home/peterr/.local/share/fonts/NotoColorEmoji.ttf'
But the result is still bad.

Do you have any more tips or advice please?
Reply
#12
A small improvement:

I changed values in the function make_svg()

# SIZE = 300, font_size = 0.8 * SIZE def make_svg(emoji_char: str, font_path: str, size: int, font_size: int): print(f'emoji_char: {emoji_char}, font_path: {font_path}, size: {size}, font_size: {font_size}') # change dominant-baseline: hanging; to auto # change dominant-baseline: hanging; to ideographic # change <text x="5" y="50">{emoji_char}</text> # <text x="5" y="230">{emoji_char}</text> # try insert color="green" # no effect return f"""<svg xmlns="http://www.w3.org/2000/svg" width="{size}" height="{size}" viewBox="0 0 {size} {size}"> <style> @font-face {{ font-family: CustomEmojiFont; src: url("{font_path}") format("truetype"); }} text {{ font-family: CustomEmojiFont, sans-serif; font-size: {font_size}px; dominant-baseline: auto; }} </style> <text x="5" y="230">{emoji_char}</text> </svg>"""
Bash output:

Output:
peterr@peterr-Modern-15-B7M:~/PVE/emoji2svg2png$ python3 export-all-emojiV3.py emoji_char: ☀, font_path: /home/peterr/.local/share/fonts/NotoColorEmoji.ttf, size: 300, font_size: 240 Exported emoji_2600_U2600.svg emoji_char: 🥚, font_path: /home/peterr/.local/share/fonts/NotoColorEmoji.ttf, size: 300, font_size: 240 Exported emoji_1F95A_U1F95A.svg emoji_char: ☕, font_path: /home/peterr/.local/share/fonts/NotoColorEmoji.ttf, size: 300, font_size: 240 Exported emoji_2615_U2615.svg emoji_char: 😁, font_path: /home/peterr/.local/share/fonts/NotoColorEmoji.ttf, size: 300, font_size: 240 Exported emoji_1F601_U1F601.svg peterr@peterr-Modern-15-B7M:~/PVE/emoji2svg2png$
Now I get the whole emoji in the output svg, but it is still black.

These output svg display ok in gimp and image viewer, but not in inkscape or imagemagick.

Is there some svg parameter to tell it to display the original shape and colour?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Unable to resolve FileNotFoundError llarkin6 6 1,657 Sep-29-2025, 05:45 PM
Last Post: noisefloor
  Get an FFMpeg pass to subprocess.PIPE to treat list as text file? haihal 2 2,317 Nov-21-2024, 11:48 PM
Last Post: haihal
  FileNotFoundError: [Errno 2] No such file or directory although the file exists Arnibandyo 0 2,663 Aug-12-2024, 09:11 AM
Last Post: Arnibandyo
  "[Errno 2] No such file or directory" (.py file) IbrahimBennani 13 14,025 Jun-17-2024, 12:26 AM
Last Post: AdamHensley
  Error (Errno 2), File upload with the Flask framework and a public IP Username_Python1 0 1,998 Mar-28-2024, 01:46 PM
Last Post: Username_Python1
  Absolute paths in subprocess - file not found kittyticker 4 5,768 Jan-28-2024, 10:37 PM
Last Post: kittyticker
  FileNotFoundError: [WinError 2] The system cannot find the file specified NewBiee 2 3,907 Jul-31-2023, 11:42 AM
Last Post: deanhystad
  Using pyinstaller with .ui GUI files - No such file or directory error diver999 3 10,772 Jun-27-2023, 01:17 PM
Last Post: diver999
  Extract file only (without a directory it is in) from ZIPIP tester_V 1 5,752 Jan-23-2023, 04:56 AM
Last Post: deanhystad
  Running script with subprocess in another directory paul18fr 1 17,723 Jan-20-2023, 02:33 PM
Last Post: paul18fr

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020
This forum uses Lukasz Tkacz MyBB addons.
Forum use Krzysztof "Supryk" Supryczynski addons.