Failed to load png image driver

189 views
Skip to first unread message

Jyothi M

unread,
Apr 18, 2017, 8:14:07 AM4/18/17
to blockdiag-discuss
Hallo,

I have pzthon file which loads the .diag file and gives me the block diagram. please find the python file code below.

import sys
import os
import random
import string
import hashlib
from blockdiag import parser, builder, drawer


__DIRECTORY = 'C:/Users/'
def main():
    input_file_name = sys.argv[1]

    with open(input_file_name) as file_pointer:
        diag_definition = file_pointer.read()

    file_name = ''.join(random.choice(string.ascii_uppercase + string.digits)
                                      for _ in range(8))
    file_path = os.path.join(__DIRECTORY, "{0}.png".format(file_name))

    tree = parser.parse_string(diag_definition)
    diagram = builder.ScreenNodeBuilder.build(tree)
    draw = drawer.DiagramDraw('PNG', diagram, filename=file_path)
    draw.draw()
    draw.save()
    print(file_path)

This works perfectly fine. I then converted .py file(version 3.3.3) to exe using py2exe (0.9.2.2). Conversion was succesful except that PIL.PngImagePlugin, PIL.Image, PIL.ImageDraw, PIL.ImageGrab, PIL.GifImagePlugin modules are missing. Later i tried testing my exe file, it gives me error that failed to load png image driver. can someone help me on this.

I dont know if its issue with blockdiag or py2exe conversion.

Thanks in advance


Komiya Takeshi

unread,
Apr 18, 2017, 10:44:23 AM4/18/17
to blockdia...@googlegroups.com
Hi,

blockdiag has a pluggable fremework using setuptools (pkg_resources).
Does py2exe support it?

Thanks,
> --
> このメールは Google グループのグループ「blockdiag-discuss」に登録しているユーザーに送られています。
> このグループから退会し、グループからのメールの配信を停止するには
> blockdiag-disc...@googlegroups.com にメールを送信してください。
> その他のオプションについては https://groups.google.com/d/optout にアクセスしてください。
Message has been deleted

Komiya Takeshi

unread,
Mar 30, 2018, 12:38:53 PM3/30/18
to blockdia...@googlegroups.com
Hi,

I guess pyinstaller also does not support loading plug-ins using pkg_resources.
I don't know the way to do that.

Thanks,
Takeshi KOMIYA



2018-03-28 18:44 GMT+09:00 Dario Cassaniti <lord...@gmail.com>:
> Hello, I have the same problem and I am using blockdiag 1.5.3.
> When i run my python program it works smoothly, but when I try to create a
> package with pyinstaller it creates an exe but then when it runs it gives me
> this error:
>
> File "site-packages\blockdiag\drawer.py", line 42, in __init__
> File "site-packages\blockdiag\imagedraw\__init__.py", line 46, in create
> RuntimeError: failed to load png image driver
> [5144] Failed to execute script reportcreator
>
> what am I doing wrong?
Reply all
Reply to author
Forward
0 new messages