grunt-webfont icon indicating copy to clipboard operation
grunt-webfont copied to clipboard

EnvironmentError: Could not load image file

Open danielwi opened this issue 12 years ago • 39 comments

Verifying property webfont.test exists in config...OK
Files: assets/icons/0000xx/mailru.svg, assets/icons/0000xx/odnoklassniki.svg, assets/icons/0000xx/pinterest.svg -> assets/icons/0000xx/build
Verifying property webfont.test.src exists in config...OK
Verifying property webfont.test.dest exists in config...OK
Reading assets/icons/0000xx/mailru.svg...OK
Writing /private/var/folders/n7/zd9vhm9j09vgqz1cdwsdykdw0000gn/T/d-11372-4052-1dwp4th/mailru.svg...OK
Reading assets/icons/0000xx/odnoklassniki.svg...OK
Writing /private/var/folders/n7/zd9vhm9j09vgqz1cdwsdykdw0000gn/T/d-11372-4052-1dwp4th/odnoklassniki.svg...OK
Reading assets/icons/0000xx/pinterest.svg...OK
Writing /private/var/folders/n7/zd9vhm9j09vgqz1cdwsdykdw0000gn/T/d-11372-4052-1dwp4th/pinterest.svg...OK
fontforge output ignored: Copyright (c) 2000-2012 by George Williams.
fontforge output ignored:  Executable based on sources from 14:57 GMT 31-Jul-2012-D.
fontforge output ignored:  Library based on sources from 14:57 GMT 31-Jul-2012.
Warning: Traceback (most recent call last):
  File "/Users/dwiklund/Desktop/grunt-webfont-test/node_modules/grunt-webfont/tasks/scripts/generate.py", line 73, in <module>
    glyph.importOutlines(filePath)
EnvironmentError: Could not load image file /private/var/folders/n7/zd9vhm9j09vgqz1cdwsdykdw0000gn/T/d-11372-4052-1dwp4th/mailru.svg Use --force to continue.

Keep getteting this error when trying to run the task... i can't figure out why, and can't find any solution to it?

I'm running gunt on Mac OSX v. 10.8.4

danielwi avatar Aug 27 '13 09:08 danielwi

Could you check existence of that file? Wrong permissions is my only idea.

sapegin avatar Aug 27 '13 10:08 sapegin

I have the same issue after i fixed the pyconfig.h file. Anyone have an solution?

Running "webfont:icons" (webfont) task Warning: Traceback (most recent call last): File "..../node_modules/grunt-webfont/tasks/scripts/generate.py", line 73, in glyph.importOutlines(filePath) EnvironmentError: Could not load image file /private/tmp/d-11372-33899-1mixup/addOnProduct.svg Use --force to continue.

MP3en avatar Aug 27 '13 13:08 MP3en

The file that is has problems loading seams to be a TEMP file since the path is /private/var/folders/n7/zd9vhm9j09vgqz1cdwsdykdw0000gn/T/d-11372-4052-1dwp4th/mailru.svg I have tried with your test SVGs and my own and get the same error

danielwi avatar Aug 27 '13 13:08 danielwi

if i debug the error with grunt --debug it says: [D] Task source: "....node_modules/grunt-webfont/tasks/webfont.js" is the problem...

MP3en avatar Aug 27 '13 13:08 MP3en

@danielwi Yeah, it’s temp files, but I can read them after running grunt. Just try cat /private/var/folders/n7/zd9vhm9j09vgqz1cdwsdykdw0000gn/T/d-11372-4052-1dwp4th/mailru.svg.

@MP3en Could you post grunt --debug output?

sapegin avatar Aug 27 '13 13:08 sapegin

@sapegin Output: Running "webfont:icons" (webfont) task [D] Task source: /node_modules/grunt-webfont/tasks/webfont.js Warning: Traceback (most recent call last): File "/node_modules/grunt-webfont/tasks/scripts/generate.py", line 73, in glyph.importOutlines(filePath) EnvironmentError: Could not load image file /private/var/folders/n9/b0frxqpx37v33t_qz57_4n6m0000gn/T/d-11372-34091-wa1wjg/addOnProduct.svg Use --force to continue.

MP3en avatar Aug 27 '13 14:08 MP3en

@MP3en Could you try cat /private/var/folders/n9/b0frxqpx37v33t_qz57_4n6m0000gn/T/d-11372-34091-wa1wjg/addOnProduct.svg?

sapegin avatar Aug 27 '13 14:08 sapegin

@sapegin Output:

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
     width="24px" height="24px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
<path fill="#0088CC" d="M21.75,0H2.25C1.005,0,0,1.005,0,2.25v19.5C0,22.995,1.005,24,2.25,24h19.5c1.245,0,2.25-1.005,2.25-2.25
    V2.25C24,1.005,22.995,0,21.75,0z M19.25,13.45h-5.8v5.8h-2.9v-5.8h-5.8v-2.9h5.8v-5.8h2.9v5.8h5.8V13.45z"/>
</svg>

But i can't execute grunt without error still the same....

MP3en avatar Aug 27 '13 14:08 MP3en

Did you guys try with just one or 2 others svg icons from iconmonster for example ?

MoOx avatar Aug 27 '13 14:08 MoOx

We tried it into our project and it worked on another mac, but the i cloned the project on my mac os x 10.8.4 with the same instructions and i received this error after solving the python pyconfig.h errror.

  1. install XCode & Homebrew
  2. brew install node
  3. brew install fontforge ttfautohint
  4. cd into my project
  5. npm install
  6. run grunt in terminal

MP3en avatar Aug 27 '13 14:08 MP3en

@sapegin i ran cat /private/v......../mailru.svg without any problems so the file exists @MoOx i have tried with 3 different files, 1 i created in illustrator, 1 of the test svgs from the repo and 1 i downloaded from icomoon.io same error every time

danielwi avatar Aug 27 '13 15:08 danielwi

Nothing helps i think its a python error because of the first lines of error code: Warning: Traceback (most recent call last): File "/node_modules/grunt-webfont/tasks/scripts/generate.py", line 73, in glyph.importOutlines(filePath)

MP3en avatar Aug 28 '13 12:08 MP3en

For some strange reason Python script (generate.py) that runs inside fontforge can’t read SVG file which exists.

sapegin avatar Aug 28 '13 12:08 sapegin

Did someone has another test demo on github to clone... that I can figure out if its me who has an framework bug ( especially python problem?) OR in best case solutions? ;)

MP3en avatar Aug 28 '13 13:08 MP3en

  1. You can try to change temp dir in https://github.com/sapegin/grunt-webfont/blob/master/tasks/webfont.js#L78-L79 to something like ~/test (create it before running webfont.
  2. You can make simplest fontforge script that will try to load any SVG file.

sapegin avatar Aug 28 '13 13:08 sapegin

@sapegin i tried #1 with same result, it copies the SVG files to the temp folder, but get the same "Could not load image file" error every time, i have tried a couple of different locations for the "temp" folder, but with same result

danielwi avatar Aug 31 '13 11:08 danielwi

@danielwi You could also try fontcustom which use almost the same script. If isn’t working too the problem is probably in fontforge itself. Which is quite strange.

sapegin avatar Aug 31 '13 17:08 sapegin

@danielwi I was originally getting the "EnvironmentError: Could not load image file" and I found a solution that worked for me. I have a Mac that pretty much had nothing installed on it, and it seems like for some reason fontforge didn't have its libxml2 dependency installed when I installed fontforge through brew. Since SVG files are structured like XML, it makes sense that it would need that library to read the SVGs. Once I installed libxml2 onto my system, I was able to build the fonts as expected. Not sure if this is the exact problem you're having, but you may want to check to make sure any dependencies fontforge has are installed as well.

KAurand avatar Sep 05 '13 19:09 KAurand

I got the same problem, it is a newly bought mac and on the old one the script runs without problems. This is strange.

yatil avatar Oct 04 '13 12:10 yatil

Yeah, it’s really strange and I don’t know what to do and how to check/fix it.

Guys, how you installed fontforge? Via homebrew? Do you have full XCode or just CLI tools?

I have full XCode and ff installed from brew.

sapegin avatar Oct 04 '13 12:10 sapegin

Hm, same here.

Let’s see (new mac):

$ which fontforge
/usr/local/bin/fontforge
$ fontforge -version
Copyright (c) 2000-2012 by George Williams.
 Executable based on sources from 14:57 GMT 31-Jul-2012-D.
 Library based on sources from 14:57 GMT 31-Jul-2012.
fontforge 20120731
libfontforge 20120731
$ which python
/usr/bin/python
$ python --version
Python 2.7.2
$ which grunt
/usr/local/bin/grunt
$ grunt -version
grunt v0.4.1

yatil avatar Oct 04 '13 13:10 yatil

The only difference is I have Python and Node installed from brew too.

Maybe brew doctor could find something?

sapegin avatar Oct 04 '13 13:10 sapegin

I get those two notes, but they seem unrelated:

$ brew doctor
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:

    /Applications/MAMP/bin/php/php5.4.19/bin/php-config

Warning: You have a curlrc file
If you have trouble downloading packages with Homebrew, then maybe this
is the problem? If the following command doesn't work, then try removing
your curlrc:
  curl http://github.com

yatil avatar Oct 04 '13 13:10 yatil

Oh, and I installed both, node and python through homebrew as well. Really confusing.

yatil avatar Oct 04 '13 13:10 yatil

Just reinstalled fontforge (they changed brew formula recently), still works. :skull:

Do you try to install libxml2 as @slackdata mentioned?

sapegin avatar Oct 04 '13 13:10 sapegin

I did and it changed nothing :-/

Sent from my iPhone

On 04.10.2013, at 15:42, Artem Sapegin [email protected] wrote:

Just reinstalled fontforge (they changed brew formula recently), still works.

Do you try to install libxml2 as @slackdata mentioned?

— Reply to this email directly or view it on GitHub.

yatil avatar Oct 04 '13 13:10 yatil

@danielwi @MP3en @yatil Could you guys try it on Maverick please?

sapegin avatar Oct 23 '13 11:10 sapegin

Just tried on Mavericks, same problem :(

danielwi avatar Oct 23 '13 12:10 danielwi

Same here, same error message. Reinstalled node and grunt even :-/

yatil avatar Oct 23 '13 14:10 yatil

Just solved the problem for me:

  1. Install Xcode and Xcode command line tools for Mavericks
  2. Uninstall like everything, especially homebrew and node.
  3. Install homebrew ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
  4. Run brew doctor and resolve all the problems
  5. Install python brew install python
  6. Install node brew install node
  7. Install fontforge & ttfautohint brew install fontforge ttfautohint
  8. Install the module: npm install grunt-webfont --save-dev
  9. There is no step 9.

RESULT!

I don’t know if that works for anyone else but it works for me. It seems to be some weird dependency that is not met somehow. It took me all day to get it working, including uninstall and reinstalling like every component.

yatil avatar Oct 23 '13 17:10 yatil