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

Unable to use pygments via PyCall #115

Closed
dpsanders opened this issue Feb 14, 2015 · 2 comments
Closed

Unable to use pygments via PyCall #115

dpsanders opened this issue Feb 14, 2015 · 2 comments

Comments

@dpsanders
Copy link

I am trying to use the Python pygments module for syntax highlighting. In Python we can do

from pygments.lexers import JuliaLexer

but the apparently equivalent

using PyCall
@pyimport pygments.lexers as lexers
lexers.JuliaLexer

gives the error

JuliaLexer not defined
while loading In[3], in expression starting on line 1

I had a look at the pygments package, and there seems to be some strange initialization going on in lexers/__init__.py that automagically instantiates the Lexer objects, or something like that, that means that the objects are not found by PyCall.

Is there any way round this problem?

@stevengj
Copy link
Member

Try lexers.pymember(:JuliaLexer)

@dpsanders
Copy link
Author

Great, thanks very much!

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