Giter Club home page Giter Club logo

Comments (46)

mdsitton avatar mdsitton commented on May 26, 2024

Its hard to look into without having your specific configuration. However What jumps out at me currently:
Unix style paths on windows?

  • / instead of \
  • No drive specified in path?

edit:
Also make sure you are using the correct dll it looks like you're using 32 bit python so make sure to use the 32 bit freetype dll.

from freetype-py.

mdsitton avatar mdsitton commented on May 26, 2024

Ok so testing a bit the only way im getting the error (error 126 module not found) is when using the wrong path separator, so it must be that.
So perhaps try this code instead?

# This joins all path parts with the os specific path seperator string.
filename = os.path.sep.join((os.path.dirname(__file__), 'DLLS', 'freetype.dll'))

try:
    _lib = ctypes.cdll.LoadLibrary(filename) # modified this using PyAssimp's load method
except (OSError, TypeError):
    _lib = None
    raise RuntimeError('Freetype library not found')

from freetype-py.

Tcll avatar Tcll commented on May 26, 2024

yea, I'm using x86 (I'm enforcing it for now until I have a solid loader to decide between x86 and x64 and load the proper interpreter)
I just have the x64 on-hand :)

anyways, yea I figured the results would be no different:

>>> 
\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\freetype\DLLS\freetype.dll
[Error 126] Module not found

Traceback (most recent call last):
  File "\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\opengl.py", line 10, in <module>
    from freetype import *
  File "\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\freetype\__init__.py", line 21, in <module>
    from freetype.raw import *
  File "\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\freetype\raw.py", line 45, in <module>
    raise RuntimeError('Freetype library not found')
RuntimeError: Freetype library not found
>>> 

and \media\tcll\ is my HDD, not to mention my method workes here:
assimp/assimp#540 (comment)
tbh, I made raw.py work just like assimp's loader (to the point of basic loading, not directory testing)

I've taken the note of the OS-specific separator, where the common separator / has worked better for me in most cases.
but heck, it was worth a try :)

I think I know one thing I could try for the drive...
Wine reserves Z: as the linux file-system drive, so I'll test that at the beginning :)

EDIT:
dang, tried it with both mine and yours:

>>> ================================ RESTART ================================
>>> 
Z:/media/tcll/copy/Tcll/UMC_workspace/UMCSL/examples/freetype/DLLS/freetype.dll
[Error 126] Module not found

Traceback (most recent call last):
  File "\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\opengl.py", line 10, in <module>
    from freetype import *
  File "\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\freetype\__init__.py", line 21, in <module>
    from freetype.raw import *
  File "\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\freetype\raw.py", line 45, in <module>
    raise RuntimeError('Freetype library not found')
RuntimeError: Freetype library not found
>>> ================================ RESTART ================================
>>> 
Z:\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\freetype\DLLS\freetype.dll
[Error 126] Module not found

Traceback (most recent call last):
  File "\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\opengl.py", line 10, in <module>
    from freetype import *
  File "\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\freetype\__init__.py", line 21, in <module>
    from freetype.raw import *
  File "\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\freetype\raw.py", line 45, in <module>
    raise RuntimeError('Freetype library not found')
RuntimeError: Freetype library not found
>>> 

tbh, the setup is for portable python (./CWD/freetype/), though I'm just using a basic python interpreter atm (for easy testing with IDLE).
(basically, use a BAT or DESKTOP to load ./Python/x86/python.exe loader.py and I have an extra 'x86' argument to load the external module binaries in the proper modes)

from freetype-py.

rougier avatar rougier commented on May 26, 2024

Can you try to directly load the DLL with the complete filename ?

from freetype-py.

Tcll avatar Tcll commented on May 26, 2024

you mean something like:

load_dir = os.path.sep.join((os.path.dirname(__file__), 'DLLS'))
for dll in os.listdir( load_dir ):
    if dll.endswith('dll'): ctypes.cdll.LoadLibrary( os.path.sep.join((load_dir, dll)) )

tbh, no I havn't, but the dll I'm using IS 'freetype.dll', so the string is correct for what it should be loading.

from freetype-py.

Tcll avatar Tcll commented on May 26, 2024

ok so I've updated the code:

load_dir = os.path.sep.join((os.path.dirname(__file__), 'DLLS'))
for dll in os.listdir( load_dir ):
    if dll.endswith('dll'):
        try:
            filename = os.path.sep.join((load_dir, dll))
            print filename
            _lib = ctypes.cdll.LoadLibrary( filename )
        except Exception as e:
            print str(e)
            _lib = None
            raise RuntimeError('Freetype library not found')

but still:

>>> 
\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\freetype\DLLS\freetype.dll
[Error 126] Module not found

Traceback (most recent call last):
  File "\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\opengl.py", line 10, in <module>
    from freetype import *
  File "\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\freetype\__init__.py", line 21, in <module>
    from freetype.raw import *
  File "\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\freetype\raw.py", line 54, in <module>
    raise RuntimeError('Freetype library not found')
RuntimeError: Freetype library not found

so yea, nothing is static now. :P

EDIT: not the best method, IK, but it works for this

from freetype-py.

rougier avatar rougier commented on May 26, 2024

Can you try:

import ctypes
import os

print os.path.exists("\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\freetype\DLLS\freetype.dll")
ctypes.cdll.LoadLibrary("\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\freetype\DLLS\freetype.dll")

print os.path.exists("/media/tcll/copy/Tcll/UMC_workspace/UMCSL/examples/freetype/DLLS/freetype.dll")
ctypes.cdll.LoadLibrary("/media/tcll/copy/Tcll/UMC_workspace/UMCSL/examples/freetype/DLLS/freetype.dll")

from freetype-py.

Tcll avatar Tcll commented on May 26, 2024

interesting, didn't know windows path splits had this much of an effect:

print os.path.exists("\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\freetype\DLLS\freetype.dll") # >>> False
print os.path.exists("/media/tcll/copy/Tcll/UMC_workspace/UMCSL/examples/freetype/DLLS/freetype.dll") # >>> True

but it still fails to load:

>>> 
False
True

Traceback (most recent call last):
  File "\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\opengl.py", line 10, in <module>
    from freetype import *
  File "\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\freetype\__init__.py", line 21, in <module>
    from freetype.raw import *
  File "\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\freetype\raw.py", line 62, in <module>
    ctypes.cdll.LoadLibrary("/media/tcll/copy/Tcll/UMC_workspace/UMCSL/examples/freetype/DLLS/freetype.dll")
  File "C:\Python27\lib\ctypes\__init__.py", line 443, in LoadLibrary
    return self._dlltype(name)
  File "C:\Python27\lib\ctypes\__init__.py", line 365, in __init__
    self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] Module not found
>>> 

from freetype-py.

mdsitton avatar mdsitton commented on May 26, 2024

Yeah they defiantly have a major effect which is why i mentioned it originally. Also by any chance are you running python in wine?

edit ok looks like you are.

from freetype-py.

Tcll avatar Tcll commented on May 26, 2024

yea, my local python interpreter just mimics my program's portable interpreter.
(it's only for testing and fun stuff with IDLE) :P

I don't think there's a linux version of portable python... heh

the point of this is so I don't need to make everyone else download every extension needed to run my program.

from freetype-py.

Tcll avatar Tcll commented on May 26, 2024

well, in the time it took to get this far on this issue, I've managed to work on a replacement.
I completely forgot pillow aka newer PIL did this with ImageFont, so I worked on getting it implemented in my program:
http://lh3.ggpht.com/-e_L9g4pTwOs/VWo-Omaj0yI/AAAAAAAAJM8/rQsmrMAO4UA/s802/pillow_fonts2.png

it's not exactly pretty though, SDL did the job much better... heh

but I'm trying to remove the destructive SDL (deletes the GL context on video resize) and move on to GLFW, which is the same thing as GLUT with SDL's control.

but don't worry, I'm not a douche, lol ;)
I started this, so why not help finish it :)

from freetype-py.

mdsitton avatar mdsitton commented on May 26, 2024

cx_freeze, py2exe, py2app ? why not just use those instead of going through all of this changing all of these libraries?

from freetype-py.

Tcll avatar Tcll commented on May 26, 2024

sorry, deleted the last comment as I misunderstood...

cx_freeze, py2exe, py2app ? why not just use those instead of going through all of this changing all of these libraries?

I want people to openly modify my source... it's complicated, but my program is the pure definition of Open Source.
UMC.exe loads python.exe with loader.py specifying enforced 'x86' mode

not everyone has everything needed to run my program, so I want to provide as much as possible.
not to mention, sometimes the updates to backends can't deal with my code and crash...
so it's good to have a backup of the library versions I used when writing my program.

from freetype-py.

mdsitton avatar mdsitton commented on May 26, 2024

Also what do you mean sdl deletes the opengl context on resize, i haven't encountered this myself.
Now if your talking about with windows when your resizing a window the rendered area wont resize until you stop sizing the windows, normally this is a separate issue with the way the win32 api works. (This bugs me as well :P)

There is a hackish way around it with the win32 api, but i've never tried to apply the workaround with sdl2 windows (might be an interesting experiment though)

from freetype-py.

mdsitton avatar mdsitton commented on May 26, 2024

Also I don't mind helping you get things going, but it may be better to move this discussion elsewhere since this isnt quite an issue with freetype-py and could be any number of things at this point.

from freetype-py.

Tcll avatar Tcll commented on May 26, 2024

yea, it deals with windowed mode...

on linux, I've found that on window resize, if I stop moving the mouse, it recalculates everything... kinda how GLUT did, but SDL still deletes my display lists and all, so the time for that is factored in... (yes, I'm using the FFP, IK it's rather deprecated, but Nvidia still supports it, and I don't feel like redoing the whole viewer interface of a scrapped build soon to be released) :P

the new build will use GLSL properly, but it'll take me muc longer to build... heh

with GLFW, I won't need to recalculate the display lists and can draw as the window resizes.

Also I don't mind trying to help you get things going, but it may be better to move this discussion elsewhere since this isnt quite an issue with freetype-py and could be any number of things at this point.

I agree, but I actually didn't intend to get off topic :P

from freetype-py.

mdsitton avatar mdsitton commented on May 26, 2024

Well with Fixed Function opengl everyone mostly still has support for it in the drivers. However I've never really messed with fixed function opengl, only the newer stuff.

from freetype-py.

mdsitton avatar mdsitton commented on May 26, 2024

You might also want to look at pyglet if you haven't already.

from freetype-py.

mdsitton avatar mdsitton commented on May 26, 2024

Also where is our project located as it might be better to make an issue over there about all of this as i said before.

from freetype-py.

Tcll avatar Tcll commented on May 26, 2024

congrats =o
I started with python NeHe tuts which started me out with GLUT/freeglut
Ian Mallet got me over to pygame/SDL and all, but I stumbled across GLFW after looking into QtGL... blah

wanna talk more on skype or email??
I kinda wanna keep this about getting the DLL working in a portable location :P

skype: Tcll5850
just let me know you're not a bot ;)

You might also want to look at pyglet if you haven't already.

yea... not such great GL support there... heh
such as 16bit float values (last I used it anyways) :P

from freetype-py.

mdsitton avatar mdsitton commented on May 26, 2024

Yeah pyglet is lacking on more advanced options.. (Although i haven't used it in a while either)
Also sent contact request.

from freetype-py.

QuLogic avatar QuLogic commented on May 26, 2024
print os.path.exists("\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\freetype\DLLS\freetype.dll") # >>> False
print os.path.exists("/media/tcll/copy/Tcll/UMC_workspace/UMCSL/examples/freetype/DLLS/freetype.dll") # >>> True

As you are not using raw strings, the backslashes are interpreted, so \t is replaced with tab (among others). Try r"\media\tcll\..." or "\\media\\tcll\\...".

from freetype-py.

rougier avatar rougier commented on May 26, 2024

Can we close this issue then ? It seems to be related to misuse of \.

from freetype-py.

Tcll avatar Tcll commented on May 26, 2024

Can we close this issue then ? It seems to be related to misuse of \.

no, it's not, freetype.dll just isn't wanting to load for whatever reason...
if you recall, the fully dynamic paths didn't work with either / or \\
(that last thing was a typo which neither of us caught)

I still have some playing around to do, pygame has libfreetype6.dll
might try that one here later >_>

from freetype-py.

rougier avatar rougier commented on May 26, 2024

So can you try:

import ctypes
import os

print os.path.exists("/media/tcll/copy/Tcll/UMC_workspace/UMCSL/examples/freetype/DLLS/freetype.dll")
ctypes.cdll.LoadLibrary("/media/tcll/copy/Tcll/UMC_workspace/UMCSL/examples/freetype/DLLS/freetype.dll")

and post result ?

from freetype-py.

Tcll avatar Tcll commented on May 26, 2024

that's the exact test I did 7 posts back... ;)
not the typo one marked False. lol

I'mma try libfreetype-6 and see if that doesn't report not found, since freetype likes to derp
(I went to bed since I posted last night, so I havn't gotten to try it yet... lol)

from freetype-py.

Tcll avatar Tcll commented on May 26, 2024

waaaaat, now I think it's just douching with me >_<

Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>> 
True

Traceback (most recent call last):
  File "\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\opengl.py", line 10, in <module>
    from freetype import *
  File "\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\freetype\__init__.py", line 21, in <module>
    from freetype.raw import *
  File "\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\freetype\raw.py", line 59, in <module>
    ctypes.cdll.LoadLibrary("/media/tcll/copy/Tcll/UMC_workspace/UMCSL/examples/freetype/DLLS/libfreetype-6.dll")
  File "C:\Python27\lib\ctypes\__init__.py", line 443, in LoadLibrary
    return self._dlltype(name)
  File "C:\Python27\lib\ctypes\__init__.py", line 365, in __init__
    self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] Module not found
>>> 

again, python sees it, but ctypes fails to load it 9_9

from freetype-py.

rougier avatar rougier commented on May 26, 2024

Weird. Can you now try to first go into /media/tcll/copy/Tcll/UMC_workspace/UMCSL/examples/freetype/DLLS/ and load directly the module from here using ctypes ? If this does not work, either your dll is buggy or it is a 64bit version.

In both cases, there is nothing much I can do. You should report the problem to ctypes.

from freetype-py.

rougier avatar rougier commented on May 26, 2024

And could you also try this

http://stackoverflow.com/questions/1940578/windowserror-error-126-the-specified-module-could-not-be-found

from freetype-py.

Tcll avatar Tcll commented on May 26, 2024

I would need to know if ctypes is able to load the dll.

the traceback itself comes from ctypes.cdll.LoadLibrary

File "\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\freetype\raw.py", line 59, in <module>
    ctypes.cdll.LoadLibrary("/media/tcll/copy/Tcll/UMC_workspace/UMCSL/examples/freetype/DLLS/libfreetype-6.dll")

the True you see comes from os.path.exists

And I really need you to test the lines I wrote, not, the freetype import * version.
??
my lines are the exact same as yours :/

I've modified raw.py with my own lines just for testing.
I'm specifically loading the dll from the static directory

if you want to see my edits, take a look: (these are updated as I save)
https://copy.com/EkKgFWklJqRuNssL

And could you also try this

you mean windll right?? (excuse my autism)
same thing >_<

>>> 
True

Traceback (most recent call last):
  File "\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\opengl.py", line 10, in <module>
    from freetype import *
  File "\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\freetype\__init__.py", line 21, in <module>
    from freetype.raw import *
  File "\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\freetype\raw.py", line 59, in <module>
    _lib = ctypes.windll.LoadLibrary("/media/tcll/copy/Tcll/UMC_workspace/UMCSL/examples/freetype/DLLS/libfreetype-6")
  File "C:\Python27\lib\ctypes\__init__.py", line 443, in LoadLibrary
    return self._dlltype(name)
  File "C:\Python27\lib\ctypes\__init__.py", line 365, in __init__
    self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] Module not found
>>> 

do take note I'm using /

from freetype-py.

Tcll avatar Tcll commented on May 26, 2024

are there any required dependencies by freetype??

EDIT: no, a quick google search helped me figure that out :P

from freetype-py.

Tcll avatar Tcll commented on May 26, 2024

even went all out:

print os.path.exists("/media/tcll/copy/Tcll/UMC_workspace/UMCSL/examples/freetype/DLLS/libfreetype-6.dll")
os.chdir("/media/tcll/copy/Tcll/UMC_workspace/UMCSL/examples/freetype/DLLS/") # DLL directory
_lib = ctypes.windll.LoadLibrary("libfreetype-6.dll")
os.chdir("/media/tcll/copy/Tcll/UMC_workspace/UMCSL/examples")

still nothing :srs:

idk...

from freetype-py.

Tcll avatar Tcll commented on May 26, 2024

even tried it in the shell:

>>> import os
>>> import ctypes
>>> os.path.exists("/media/tcll/copy/Tcll/UMC_workspace/UMCSL/examples/freetype/DLLS/libfreetype-6.dll")
True
>>> ctypes.windll.LoadLibrary("/media/tcll/copy/Tcll/UMC_workspace/UMCSL/examples/freetype/DLLS/libfreetype-6")

Traceback (most recent call last):
  File "<pyshell#4>", line 1, in <module>
    ctypes.windll.LoadLibrary("/media/tcll/copy/Tcll/UMC_workspace/UMCSL/examples/freetype/DLLS/libfreetype-6")
  File "C:\Python27\lib\ctypes\__init__.py", line 443, in LoadLibrary
    return self._dlltype(name)
  File "C:\Python27\lib\ctypes\__init__.py", line 365, in __init__
    self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] Module not found
>>> os.chdir("/media/tcll/copy/Tcll/UMC_workspace/UMCSL/examples/freetype/DLLS/")
>>> _lib = ctypes.windll.LoadLibrary("libfreetype-6.dll")

Traceback (most recent call last):
  File "<pyshell#6>", line 1, in <module>
    _lib = ctypes.windll.LoadLibrary("libfreetype-6.dll")
  File "C:\Python27\lib\ctypes\__init__.py", line 443, in LoadLibrary
    return self._dlltype(name)
  File "C:\Python27\lib\ctypes\__init__.py", line 365, in __init__
    self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] Module not found
>>> _lib = ctypes.windll.LoadLibrary("freetype.dll")

Traceback (most recent call last):
  File "<pyshell#7>", line 1, in <module>
    _lib = ctypes.windll.LoadLibrary("freetype.dll")
  File "C:\Python27\lib\ctypes\__init__.py", line 443, in LoadLibrary
    return self._dlltype(name)
  File "C:\Python27\lib\ctypes\__init__.py", line 365, in __init__
    self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] Module not found
>>> 

I'm out of ideas

EDIT: yes, I have both dlls in that directory... heh

from freetype-py.

rougier avatar rougier commented on May 26, 2024

There is a missing .dll in the ctype.windll..., can you try again ?

from freetype-py.

Tcll avatar Tcll commented on May 26, 2024

There is a missing .dll' in thectype.windll...`, can you try again ?

from what I read, this shouldn't matter, but I did, and as expected, no difference...

I even tried the method PyOpenGL uses:

>>> ctypes.windll._dlltype("/media/tcll/copy/Tcll/UMC_workspace/UMCSL/examples/freetype/DLLS/libfreetype-6.dll", ctypes.RTLD_GLOBAL)

Traceback (most recent call last):
  File "<pyshell#13>", line 1, in <module>
    ctypes.windll._dlltype("/media/tcll/copy/Tcll/UMC_workspace/UMCSL/examples/freetype/DLLS/libfreetype-6.dll", ctypes.RTLD_GLOBAL)
  File "C:\Python27\lib\ctypes\__init__.py", line 365, in __init__
    self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] Module not found

idk... I'm just pulling stuff that works out of hats and trying to load this dll with them...

from freetype-py.

QuLogic avatar QuLogic commented on May 26, 2024

It sounds to me that your freetype DLL depends on another that you don't have. Have you tried running Dependency Walker on it?

from freetype-py.

mdsitton avatar mdsitton commented on May 26, 2024

I still think the issue has to be some kind of bug with the version of wine he is using. Because when doing this in wine for me i don't have this issue.

from freetype-py.

mdsitton avatar mdsitton commented on May 26, 2024

interesting im getting the same issue running wine on OS X...

>>> ctypes.CDLL(os.getcwd()+'\\freetype\\x86\\freetype.dll')
err:module:import_dll Library MSVCR120.dll (which is needed by L"Z:\\Users\\matthew\\Downloads\\freetype\\x86\\freetype.dll") not found
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\python27\lib\ctypes\__init__.py", line 365, in __init__
    self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] Module not found
>>> os.path.exists(os.getcwd()+'\\freetype\\x86\\freetype.dll')
True
>>>

edit:
This might be a different issue let me install the vc++ runtime :P

edit2:
So yeah after installing the vc++ runtime with winetricks it works fine...

I used the following command to install it since its ui didnt want to work on osx...

winetricks vcrun2013

The result:

>>> os.path.exists(os.getcwd()+'\\freetype\\x86\\freetype.dll')
True
>>> ctypes.CDLL(os.getcwd()+'\\freetype\\x86\\freetype.dll')
<CDLL 'Z:\Users\matthew\Downloads\freetype\x86\freetype.dll', handle 710000 at 5223b0>
>>>

from freetype-py.

Tcll avatar Tcll commented on May 26, 2024

just wanted to mention, I gave pygame's freetype implementation a test, all it was missing was zlib1.dll
(thanks for telling me about depends, it really helped) ;)

so anyways, pygame's dll returns this:

>>> 

Traceback (most recent call last):
  File "\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\opengl.py", line 10, in <module>
    from freetype import *
  File "\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\freetype\__init__.py", line 21, in <module>
    from freetype.raw import *
  File "\media\tcll\copy\Tcll\UMC_workspace\UMCSL\examples\freetype\raw.py", line 133, in <module>
    FT_Get_Advance         = _lib.FT_Get_Advance
  File "C:\Python27\lib\ctypes\__init__.py", line 378, in __getattr__
    func = self.__getitem__(name)
  File "C:\Python27\lib\ctypes\__init__.py", line 383, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: function 'FT_Get_Advance' not found

so we're finally getting somewhere :)
but yeh, looks like this extension's ahead of pygame :P

is there a better freetype.dll build you could recommend, instead of requiring MSVCR (eww)
thanks :)

from freetype-py.

Tcll avatar Tcll commented on May 26, 2024

ok, so I was wrong... freetype2 is not ahead of freetype6... heh

I've just ported my local extension from freetype2 to freetype6
(I don't need to install VS2013 to get it working)
^ I can't install VS2013 anyways... highest I can go is VS2010 on half my compys (not sure about linux)

I'm using pygame's libfreetype-6.dll with zlib1.dll
code-mods:
1: commented out FT_Get_Advance = _lib.FT_Get_Advance
2: loaded libfreetype-6.dll with ctypes.cdll.LoadLibrary (this is actually required)

take a look :)
http://lh3.ggpht.com/-paQaDqCowD4/VW4hjS6xT7I/AAAAAAAAJOI/N127efaJxE0/s602/Screenshot%252520-%25252006022015%252520-%25252005%25253A29%25253A25%252520PM.png
^ examples/opengl.py running on freetype6 ;)

EDIT:
feel free to close this issue unless you have any inputs ;)

from freetype-py.

mdsitton avatar mdsitton commented on May 26, 2024

So it looks like we have figured it out somewhat. I ended up recompiling freetype in what is basically windows xp mode... Then having the VC runtime statically linked.

Here are the updated dlls.
https://dl.dropboxusercontent.com/u/37405488/freetype-vs13-winxp.zip

from freetype-py.

Tcll avatar Tcll commented on May 26, 2024

just here to confirm, I tried out the x86 version before he compiled the x64 ;)

EDIT: btw, restored the part I commented out earlier and even that works ;)

from freetype-py.

Tcll avatar Tcll commented on May 26, 2024

btw, here's a better loader than before:

edits to freetype/raw.py:

import sys,os
import platform
from ctypes import *
import ctypes.util

from freetype.ft_types import *
from freetype.ft_enums import *
from freetype.ft_errors import *
from freetype.ft_structs import *

# on windows all ctypes does when checking for the library
# is to append .dll to the end and look for an exact match
# within any entry in PATH.
found = ctypes.util.find_library('freetype')
filepath,filename = (None,None) if not found else os.path.split(found)

if filename is None:
    if platform.system() == 'Windows':
        # Check current working directory for dll as ctypes fails to do so
        filepath = os.path.realpath('.')
        filename = 'freetype.dll'
    else:
        filepath = ''
        filename = 'libfreetype.so.6'
    if not os.path.exists(os.path.join(filepath,filename)): filepath=None

    if filepath is None:
        for path in sys.path:
            if os.path.exists(os.path.join(path,filename)): filepath=path; break

    if filepath is None:
        raise RuntimeError('Freetype library not found')

try:
    lastcwd = os.getcwd()
    os.chdir(filepath) # this method succeeds LoadLibrary(os.path.join(filepath,filename)) fails.
    _lib = ctypes.cdll.LoadLibrary(filename)
    os.chdir(lastcwd)
except (OSError, TypeError):
    _lib = None
    raise RuntimeError('Freetype library dependences not installed')

and, just in case the version of the freetype binary has an issue:

try: FT_Get_Advance         = _lib.FT_Get_Advance
except: pass # FT_Get_Advance not defined in binary

I suck at making commits :P

how you use this is simply extend the search paths before importing ;)
for example:

import sys,os
sys.path.append( os.path.sep.join((os.path.dirname(__file__),'DLLS')) )
from freetype import *

enjoy :)

from freetype-py.

rougier avatar rougier commented on May 26, 2024

Ok. Can you open a PR ?
I close the issuer

from freetype-py.

Tcll avatar Tcll commented on May 26, 2024

Ok. Can you open a PR ?

dangit... lol
I was trying to avoid that Q... XD
I'll give it another try, but don't be surprized if it doesn't go through... :P

I suck at making commits :P

<<< that included PRs, I just didn't think of them... lol

you could always download it as well... heh
actually, I have an update on the link for that:
https://copy.com/KtK1nG3FPp2BK4bV

from freetype-py.

HinTak avatar HinTak commented on May 26, 2024

If you are not building the windows freetype dll yourself (I do, and cross-compile too, but not everybody wants to), find out how it is built, and what it depends on. Here is how:

  • if you are on windows, dependecy walker is your friend.

  • if you are using wine, dependency walker works on wine too. But you don't need dependency walker if you already have wine, since you can achieve the same result with winedump -j import <thedll> to look at the dll's import table directly, which gives you the same information.

from freetype-py.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.