yaqwsx / PcbDraw

Convert your KiCAD board into a nicely looking 2D drawing suitable for pinout diagrams
MIT License
1.16k stars 91 forks source link

Fails to generate PNGs #58

Closed agambier closed 3 years ago

agambier commented 3 years ago

Hi,

I've tried to generate PNGs for a board but it keeps failing. I've installed PcbDraw v0.6.1 using the command:

pip3 install PcbDraw

ImageMagick v6.9.7 is also installed.

When I run the command :

pcbdraw ./myboard.kicad_pcb ./front.png

The output is, (I've removed the warnings about missing footprint) :

Traceback (most recent call last): File "/home/agambier/.local/bin/pcbdraw", line 11, in sys.exit(main()) File "/home/agambier/.local/lib/python3.6/site-packages/pcbdraw/pcbdraw.py", line 811, in main svg_to_bitmap(tmp_f.name, args.output, dpi=args.dpi) File "/home/agambier/.local/lib/python3.6/site-packages/pcbdraw/pcbdraw.py", line 602, in svg_to_bitmap image.read(filename=infile, resolution=dpi) File "/home/agambier/.local/lib/python3.6/site-packages/wand/image.py", line 9668, in read self.raise_exception() File "/home/agambier/.local/lib/python3.6/site-packages/wand/resource.py", line 222, in raise_exception raise e wand.exceptions.FileOpenError: unable to open file `/tmp/magick-20982rDwer1eM32jv': No such file or directory @ error/constitute.c/ReadImage/544

AnyIdea what's missing on my system ? thanks.

yaqwsx commented 3 years ago

Hello, the error you report is pretty strange. It seems that the temporary file used by ImageMagick gone missing or you don't have permission to open it. The error happens inside the library Wand. Try to reach out to them to ask for help.

Also, do you have enough space in your temp directory? Do you use some utility that purges the temp directory (which could falsely detect that the image is no longer useful)?

agambier commented 3 years ago

Hello,

Thanks for your reply.

Also, do you have enough space in your temp directory?

Yes I tried to create a 10GB temp file as a regular user and it worked ! I also tried to run pcbdraw as sudo but it failed too.

Do you use some utility that purges the temp directory (which could falsely detect that the image is no longer useful)?

Nope.

I also googled about wand and this error but didn't find anything useful. I'll ask the Wand's dev team and let you know what's going on.

agambier commented 3 years ago

Thanks to the Wand's author this issue is fixed. The package librsvg2-bin wasn't installed. It contains _rsvgconvert. Once installed everything works fine.

dj140 commented 2 years ago

I have the same problem but in windows, how can i install librsvg2-bin package in windows ?

Traceback (most recent call last):
  File "E:\6.0\bin\Lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "E:\6.0\bin\Lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "E:\6.0\bin\Scripts\pcbdraw.exe\__main__.py", line 7, in <module>
  File "E:\6.0\bin\Lib\site-packages\pcbdraw\pcbdraw.py", line 960, in main
    svg_to_bitmap(tmp_f.name, args.output, dpi=args.dpi)
  File "E:\6.0\bin\Lib\site-packages\pcbdraw\pcbdraw.py", line 670, in svg_to_bitmap
    image.read(filename=infile, resolution=dpi)
  File "E:\6.0\bin\Lib\site-packages\wand\image.py", line 9815, in read
    self.raise_exception()
  File "E:\6.0\bin\Lib\site-packages\wand\resource.py", line 222, in raise_exception
    raise e
wand.exceptions.BlobError: unable to open image 'C:\Users\nuc\AppData\Local\Temp\tmpcxvo8ufo.svg': Permission denied @ error/blob.c/OpenBlob/3527