Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error downloading font awesome using command example #15

Open
nasmal opened this issue Mar 25, 2020 · 3 comments
Open

Error downloading font awesome using command example #15

nasmal opened this issue Mar 25, 2020 · 3 comments

Comments

@nasmal
Copy link

nasmal commented Mar 25, 2020

Running the first example I get the error urllib.error.HTTPError: HTTP Error 404: Not Found.

On OSX 10.15.2 and Python 3.5.6:

(env) nathan@Nathans-MBP fontawesometopng % icon-font-to-png --download font-awesome
Traceback (most recent call last):

File "/Users/nathan/Playground/fontawesometopng/env/bin/icon-font-to-png", line 16, in
command_line.run(sys.argv[1:])
File "/Users/nathan/Playground/fontawesometopng/env/lib/python3.5/site-packages/icon_font_to_png/command_line.py", line 85, in run
downloader = download_icon_font(args.download, os.getcwd())
File "/Users/nathan/Playground/fontawesometopng/env/lib/python3.5/site-packages/icon_font_to_png/command_line.py", line 172, in download_icon_font
downloader.download_files()
File "/Users/nathan/Playground/fontawesometopng/env/lib/python3.5/site-packages/icon_font_to_png/icon_font_downloader.py", line 75, in download_files
self.css_path = self.download_css(self.directory)
File "/Users/nathan/Playground/fontawesometopng/env/lib/python3.5/site-packages/icon_font_to_png/icon_font_downloader.py", line 67, in download_css
return self._download_file_from_url(self.css_url, directory)
File "/Users/nathan/Playground/fontawesometopng/env/lib/python3.5/site-packages/icon_font_to_png/icon_font_downloader.py", line 49, in _download_file_from_url
return urlretrieve(url, filename=css_filename)[0]
File "/Users/nathan/.pyenv/versions/3.5.6/lib/python3.5/urllib/request.py", line 188, in urlretrieve
with contextlib.closing(urlopen(url, data)) as fp:
File "/Users/nathan/.pyenv/versions/3.5.6/lib/python3.5/urllib/request.py", line 163, in urlopen
return opener.open(url, data, timeout)
File "/Users/nathan/.pyenv/versions/3.5.6/lib/python3.5/urllib/request.py", line 472, in open
response = meth(req, response)
File "/Users/nathan/.pyenv/versions/3.5.6/lib/python3.5/urllib/request.py", line 582, in http_response
'http', request, response, code, msg, hdrs)
File "/Users/nathan/.pyenv/versions/3.5.6/lib/python3.5/urllib/request.py", line 510, in error
return self._call_chain(*args)
File "/Users/nathan/.pyenv/versions/3.5.6/lib/python3.5/urllib/request.py", line 444, in _call_chain
result = func(*args)
File "/Users/nathan/.pyenv/versions/3.5.6/lib/python3.5/urllib/request.py", line 590, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

@natehudson
Copy link

I think this is broken since the release of FA6. Here is a simple workaround to download the older v4 files locally into your working directory and then the example commands will work:

# download v4 ttf
curl -o fontawesome-webfont.ttf https://raw.githubusercontent.com/FortAwesome/Font-Awesome/fa-4/fonts/fontawesome-webfont.ttf

# download v4 css
curl -o font-awesome.css https://raw.githubusercontent.com/FortAwesome/Font-Awesome/fa-4/css/font-awesome.css

# test examples
icon-font-to-png --css font-awesome.css --ttf fontawesome-webfont.ttf --size 64 play stop

# should work and output
file ./exported/play.png ./exported/stop.png
./exported/play.png: PNG image data, 64 x 64, 8-bit/color RGBA, non-interlaced
./exported/stop.png: PNG image data, 64 x 64, 8-bit/color RGBA, non-interlaced

@chucker
Copy link

chucker commented Dec 19, 2022

Newer URLs:

# download v4 ttf curl -Lo fontawesome-webfont.ttf https://github.com/FortAwesome/Font-Awesome/raw/4.x/fonts/fontawesome-webfont.ttf

# download v4 css curl -o font-awesome.css https://raw.githubusercontent.com/FortAwesome/Font-Awesome/4.x/css/font-awesome.css

@pmorch
Copy link

pmorch commented Apr 11, 2023

Downloading them can also be done with npm:

# use a local node_modules directory
npm init -y

#  @fortawesome/fontawesome-free is the newest version, but
# this installs the 4.X version
npm install font-awesome

# use it
icon-font-to-png --css node_modules/font-awesome/css/font-awesome.css  --ttf node_modules/font-awesome/fonts/fontawesome-webfont.ttf --list

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants