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

AttributeError: module 'freetype' has no attribute 'Face' #182

Closed
prusso630 opened this issue Dec 15, 2023 · 2 comments
Closed

AttributeError: module 'freetype' has no attribute 'Face' #182

prusso630 opened this issue Dec 15, 2023 · 2 comments

Comments

@prusso630
Copy link

import freetype
face = freetype.Face("Vera.ttf")
face.set_char_size( 48*64 )
face.load_char('S')
bitmap = face.glyph.bitmap
print(bitmap.buffer)

AttributeError: module 'freetype' has no attribute 'Face'

Why might there be no attribute face after pip install freetype-py on Windows 11 Pro for package 2.4.0?

@prusso630
Copy link
Author

I had to rename a file I was using from freetype python to something else...

@HinTak
Copy link
Collaborator

HinTak commented Dec 15, 2023

Already answered that question on freetype-devel. The most likely problem is that you are loading something else which contains an unrelated "freetype.py" file somewhere. This is either in your current directory, or somewhere in your python load path. Check your current directory, your PYTHONPATH environment variable, your sys.path variable inside python, and generally, read about how python searches and finds packages. There are plenty of tutorials on "python path" on Google. Lastly, try this:

import freetype
print(freetype.version())

It should print "(2, X, Y)", where X should be 10+. (current is 2, 13, 2). If it is anything else, or result in an error, you need to check your installation.

@HinTak HinTak closed this as completed Dec 15, 2023
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

2 participants