encoding problem in mac os x

Hi,

I managed to compile graph-tool 2.2.5 and to solve linking problems
with libcgal (thanks to tcb).
When I try to import the graph_tool module i got this error:

In [1]: import graph_tool.all as gt

I managed to compile graph-tool 2.2.5 and to solve linking problems
with libcgal (thanks to tcb).

Could you please share what kind of problem you had with linking to
cgal, and how you resolved it, so that I can incorporate the fix?

When I try to import the graph_tool module i got this error:

In [1]: import graph_tool.all as gt
------------------------------------------------------------
   File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/graph_tool/topology/__init__.py",
line 138
SyntaxError: Non-ASCII character '\xe2' in file
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/graph_tool/topology/__init__.py
on line 139, but no encoding declared; see
http://www.python.org/peps/pep-0263.html for details (__init__.py,
line 138)

do you have any idea?

This is very strange... The error seems to say that there is some UTF-8
character in the file shown. However I see nothing of the sort, when I
inspect the file myself (and I don't get this error). Can you look at
the line 138 in the file to see if you find anything wrong? This line is
part of a docstring, so you can try removing it to see what happens.

What python version are you using?

Cheers,
Tiago

I managed to compile graph-tool 2.2.5 and to solve linking problems
with libcgal (thanks to tcb).

Could you please share what kind of problem you had with linking to
cgal, and how you resolved it, so that I can incorporate the fix?

I believe it's a problem with cgal's build in macports. basically when
i build graph_tool, the .so are linked to libCGAL with a relative
path:

tyler:~ hammer$ otool -L
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/graph_tool/topology/libgraph_tool_topology.so
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/graph_tool/topology/libgraph_tool_topology.so:
  /opt/local/Library/Frameworks/Python.framework/Versions/2.6/Python
(compatibility version 2.6.0, current version 2.6.0)
  /opt/local/lib/libboost_iostreams-mt.dylib (compatibility version
0.0.0, current version 0.0.0)
  /opt/local/lib/libboost_python-mt.dylib (compatibility version 0.0.0,
current version 0.0.0)
  /opt/local/lib/libboost_regex-mt.dylib (compatibility version 0.0.0,
current version 0.0.0)
  /opt/local/lib/libexpat.1.dylib (compatibility version 7.0.0, current
version 7.2.0)
  libCGAL.4.dylib (compatibility version 4.0.0, current version 4.0.0)
  /opt/local/lib/gcc44/libstdc++.6.dylib (compatibility version 7.0.0,
current version 7.13.0)
  /opt/local/lib/gcc44/libgcc_s.1.dylib (compatibility version 1.0.0,
current version 1.0.0)
  /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 111.1.4)

which is solved for every .so through install_name_tool (thanks to a
suggestion by tcb):

bash-3.2# install_name_tool -change libCGAL.4.dylib
/opt/local/lib/libCGAL.4.dylib
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/graph_tool/topology/libgraph_tool_topology.so

etc.

Do you have any suggestions?

When I try to import the graph_tool module i got this error:

In [1]: import graph_tool.all as gt
------------------------------------------------------------
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/graph_tool/topology/__init__.py",
line 138
SyntaxError: Non-ASCII character '\xe2' in file
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/graph_tool/topology/__init__.py
on line 139, but no encoding declared; see
http://www.python.org/peps/pep-0263.html for details (__init__.py,
line 138)

do you have any idea?

This is very strange... The error seems to say that there is some UTF-8
character in the file shown. However I see nothing of the sort, when I
inspect the file myself (and I don't get this error). Can you look at
the line 138 in the file to see if you find anything wrong? This line is
part of a docstring, so you can try removing it to see what happens.

What python version are you using?

I'm using python 2.6. I solved by removing the reference in the
documentation. that's weird indeed, opening the file with vim or less
at that line didn't show anything worth mentioning!

I finally managed to run grap_tool on my mac! :slight_smile:

I managed to compile graph-tool 2.2.5 and to solve linking problems
with libcgal (thanks to tcb).

Could you please share what kind of problem you had with linking to
cgal, and how you resolved it, so that I can incorporate the fix?

I believe it's a problem with cgal's build in macports. basically when
i build graph_tool, the .so are linked to libCGAL with a relative
path:

[...]

Do you have any suggestions?

Hm, not really... I have no idea why the full path is not used by the
linker.

I'm using python 2.6. I solved by removing the reference in the
documentation. that's weird indeed, opening the file with vim or less
at that line didn't show anything worth mentioning!

I have now added encoding information in the python source files in the
git repository, so that even if the files include utf-8 characters, it
should not be a problem. Would you care to test if the problem is still
there?

I finally managed to run grap_tool on my mac! :slight_smile:

Congratulations! :slight_smile:

Cheers,
Tiago