Kozea / pygal

PYthon svg GrAph plotting Library
https://www.pygal.org
GNU Lesser General Public License v3.0
2.66k stars 413 forks source link

support cx_freeze #108

Open dynamicgl opened 10 years ago

dynamicgl commented 10 years ago

Hi I had a problem when use pygal with cx_freeze. I noticed in svg.py or utils.py, there are many codes related to access resource files like css or worldmap.svg like:

css = os.path.join(os.path.dirname(file), 'css', css)

the problem is when cx_freeze freeze the whole app, all dependencies will be packed into a single library.zip. os.path.join(os.path.dirname(file)) will give sth like xxx/library.zip/pygal/css/base.css which is an invalid path (library.zip is not a directory). My work around is to use os.getcwd() instead and copy resource files.

Is it possible to provide a method to configure the path in Config class or sth like that? Thanks.

BTW: I just realized I could use zipfile.ZipFile to read files in a zip file and it worked; however We still need to modify the code quite a bit.

paradoxxxzero commented 10 years ago

I'll voluntary merge a good PR.