SFML community forums

Bindings - other languages => Python => Topic started by: Solved on June 13, 2009, 09:42:35 pm

Title: Having trouble getting PySFML to work
Post by: Solved on June 13, 2009, 09:42:35 pm
I am having trouble getting PySFML to work.
I am using python 3.0 on windows. I have tried to install PySFML from both development files and the SDK. After adding the development files to the correct directories and typing
Code: [Select]
from PySFML import sf I get an error message saying
Code: [Select]
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    from PySFML import sf
ImportError: DLL load failed: The specified module could not be found.


The module sf.pyd is in the correct directory yet python cannot find it.

I have also tried to install from the SDK. I get this error message.
Code: [Select]
running install
running build
running build_py
running build_ext
building 'PySFML.sf' extension
c:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W
3 /GS- /DNDEBUG -I../include -IC:\Python30\include -IC:\Python30\PC /Tpsrc/Clock
.cpp /Fobuild\temp.win32-3.0\Release\src/Clock.obj
Clock.cpp
c:\documents and settings\andrew\my documents\downloads\sfml-1.5-python-sdk\sfml
-1.5\python\src\Clock.hpp(30) : fatal error C1083: Cannot open include file: 'SF
ML/System/Clock.hpp': No such file or directory
error: command '"c:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe"' fa
iled with exit status 2


If anyone could tell me where I've gone wrong I would greatly appreciate it.
Title: Having trouble getting PySFML to work
Post by: rfrank.nj on June 24, 2009, 01:24:16 pm
I'm having the same problem with Python 2.6 on Windows.  I get this error:

Code: [Select]
C:\Russ\development\python\sfml>python test.py
Traceback (most recent call last):
  File "test.py", line 2, in <module>
    from PySFML import sf
ImportError: DLL load failed: The specified module could not be found.


I tried putting the precompiled DLLs into the C:\Python26\Lib\site-packages\PySFML folder, and I get this error:

Code: [Select]
C:\Russ\development\python\sfml>python test.py
Traceback (most recent call last):
  File "test.py", line 2, in <module>
    from PySFML import sf
ImportError: DLL load failed: The specified procedure could not be found.


Thanks in advance for any help
Title: Having trouble getting PySFML to work
Post by: remi.k2620 on June 24, 2009, 02:40:42 pm
Well I need to recompile properly those DLLs. The fact is I don't have windows anymore but I'll try to compile it with wine under linux.
Edit : I recompiled and uploaded the dlls here : http://download.tuxfamily.org/remi/python/pysfml_test/. Can you try and tell me if it works for you ? It works with wine but I would like to know if it works with a real windows install.
Title: Having trouble getting PySFML to work
Post by: rfrank.nj on June 24, 2009, 04:45:30 pm
Quote from: "remi.k2620"
Well I need to recompile properly those DLLs. The fact is I don't have windows anymore but I'll try to compile it with wine under linux.
Edit : I recompiled and uploaded the dlls here : http://download.tuxfamily.org/remi/python/pysfml_test/. Can you try and tell me if it works for you ? It works with wine but I would like to know if it works with a real windows install.


Code: [Select]
C:\Russ\development\python\sfml>python test.py
Traceback (most recent call last):
  File "test.py", line 2, in <module>
    from PySFML import sf
ImportError: DLL load failed: The specified module could not be found.


What should be in the C:\Python26\Lib\site-packages\PySFML directory?  Currently I only have __init__.py, __init__.pyd and sf.pyd.
Title: Having trouble getting PySFML to work
Post by: remi.k2620 on June 24, 2009, 05:18:27 pm
I compiled it with mingw so you need to download the sfml mingw libraries : http://downloads.sourceforge.net/sfml/SFML-1.5-dev-windows-mingw.zip
You need sfml-graphics.dll, sfml-system.dll, sfml-window.dll, sfml-audio.dll, and from the extlibs folder : libsndfile-1.dll and openal32.dll
Title: Having trouble getting PySFML to work
Post by: rfrank.nj on June 24, 2009, 05:33:23 pm
It works! Awesome, thanks.
Title: Having trouble getting PySFML to work
Post by: Ezbez on July 05, 2009, 12:39:22 pm
As an alternative, I wrote an installation guide (http://www.sfml-dev.org/wiki/en/tutorials/installpysfml) for PySFML on the wiki. It says how to compile the SDK. I wrote it for 1.4, but it works analogously for 1.5! I'm not sure if it works for Python 3.0 or 2.5 - I've only tested on 2.6. (Feel free to confirm it for other Python versions and edit the wiki accordingly!)
Title: Having trouble getting PySFML to work
Post by: m00npirate on April 27, 2010, 01:43:07 am
Hello,
I followed your tutorial but encountered the following error when trying to install the setup.py using cygwin (building it seemed to work fine):

first i tried to just do
>python setup.py install
but it gets mad at me for not having visual studio 2003 - no problem ill just pass it -cmingw32 like I did when I built it. But no, it tells me
"error: option -m not recognized."

If I try what it says to use, "-c mingw32" (without quotes), it says
"error: invalid command 'mingw32'"

Any help is appreciated!

EDIT:
I deleted build and started again this time using:
Code: [Select]
python setup.py build --compiler=mingw32 install
and this worked fine, I then followed the rest of the steps in your tutorial and copied over all the DLLs. Unfortunately I still get the error
Code: [Select]
>>> from PySFML import sf
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    from PySFML import sf
ImportError: cannot import name sf

when I try to use the module.

EDIT2: I copied EVERYTHING from \SFML-1.5\lib\mingw into my C:\Python25\Lib\site-packages\PySFML and this allowed it to be imported. The samples crash immediately after loading however (except the sound ones which work fine). They give no error, just crash (even with an added try...except they report no error)