chrisidefix / cgal-bindings

Automatically exported from code.google.com/p/cgal-bindings
Boost Software License 1.0
0 stars 0 forks source link

triangulation_prog1.py example gives: ImportError: No module named 'CGAL',on windows 8 #34

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Generate VS2010 Solution with cmake.
2. Build solution with VS2010.
3. Add () to print for python 3 in examples\python>triangulation_prog1.py, and 
run it from command line.

What is the expected output? What do you see instead?
I expect a list of points to be printed, but I get: 

Traceback (most recent call last):
  File "C:\cgal-bindings\examples\python\triangulation_prog1.py", line 1, in <module>
    from CGAL.CGAL_Kernel import Point_2
ImportError: No module named 'CGAL'

What version of the product are you using? On what operating system?
cgal-bindings: git commit fef3e0e70ee4a1258e0cf865cf322e0c3f102f58
Cmake 2.8.11.1, Python 3.3.0, CGAL 4.2, boost 1.53, swigwin 2.0.10 on Windows 8.

Please provide any additional information below.

Original issue reported on code.google.com by mario.de...@gmail.com on 24 Jun 2013 at 10:08

GoogleCodeExporter commented 9 years ago
Have you added the built python bindings to the path of the python executable?

Original comment by sloriot...@gmail.com on 24 Jun 2013 at 10:15

GoogleCodeExporter commented 9 years ago
As I am pretty new to python I am not sure what you are refering to. I tried 
adding cgal-bindings\lib\Release to the PATH environment variable, because it 
containts all the dlls, and in the python console I did 
sys.path.append('C:\cgal-bindings\\build-python')
, where the \\ is to avoid conversion of \b to \x08. Both did not help.

Original comment by mario.de...@gmail.com on 24 Jun 2013 at 10:32

GoogleCodeExporter commented 9 years ago
Try googl-ing PYTHONPATH

Original comment by sloriot...@gmail.com on 24 Jun 2013 at 3:01

GoogleCodeExporter commented 9 years ago
Thank you. I seem to have fallen for the general confusion on paths in python. 
But the problem persists after adding the variable PYTHONPATH to the 
environment. It actually seems to have the equivalent effect of adding them 
manually to sys.path each time. Where and in which file is the module CGAL 
supposed to be found? My sys.path looks like this now:

>>> print(sys.path)
['', 'C:\\cgal-bindings\\lib\\Release', 'C:\\cgal-bindings\\lib\\Debug', 'C:\\cg
al-bindings\\build-python\\CGAL\\Release', 'C:\\cgal-bindings\\build-python\\CGA
L\\Debug', 'C:\\windows\\SYSTEM32\\python33.zip', 'C:\\Python33\\DLLs', 'C:\\Pyt
hon33\\lib', 'C:\\Python33', 'C:\\Python33\\lib\\site-packages']

Original comment by mario.de...@gmail.com on 25 Jun 2013 at 2:12

GoogleCodeExporter commented 9 years ago
PYTHONPATH should point to path PYTHON_OUTDIR_PREFIX in the file CMakeCache.txt 
where you built the library

Original comment by sloriot...@gmail.com on 26 Jun 2013 at 5:20

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Thanks a lot, it finally works. However, I had to add the 3 paths to PYTHONPATH:
%PYTHON_OUTDIR_PREFIX%
%PYTHON_OUTDIR_PREFIX%\CGAL
%PYTHON_OUTDIR_PREFIX%\CGAL\Release

Original comment by mario.de...@gmail.com on 26 Jun 2013 at 6:14