Giter Site home page Giter Site logo

code-guide's People

Contributors

npryce avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

code-guide's Issues

Setup.py does not specify a platform dependency on Python 2.7

When I try to convert the example file test.py

#|| Hello World
#|| ===========
#||
#|| Hello world is traditionally used to illustrate to beginners 
#|| the most basic syntax of a programming language, or to verify 
#|| that a language or system is operating correctly.

#| This is all that is required in Python
print "hello, world"
#|.

... on a fresh install of Python 3.3.1 via Homebrew on a Mac, the conversion stops when the actual code markup should begin. The generated HTML console output of code-guide test.py is:

<html><head><title>Hello World</title><link rel="stylesheet" type="text/css" href="code_guide/bootstrap/css/bootstrap.min.css"></link><link rel="stylesheet" type="text/css" href="code_guide/bootstro.min.css"></link><link rel="stylesheet" type="text/css" href="code_guide/pygments.css"></link><link rel="stylesheet" type="text/css" href="code_guide/code-guide.css"></link><script type="text/javascript" src="code_guide/jquery-1.9.1.min.js"></script><script type="text/javascript" src="code_guide/bootstrap/js/bootstrap.min.js"></script><script type="text/javascript" src="code_guide/bootstro.min.js"></script><script type="text/javascript" src="code_guide/code-guide.js"></script></head><body><div class="code-guide-intro"><h1>Hello World</h1>

Hello world is traditionally used to illustrate to beginners the most basic syntax of a programming language, or to verify that a language or system is operating correctly.

Explain!

... and is followed by this runtime error:

  File "/usr/local/lib/python3.3/site-packages/code_guide/__init__.py", line 346, in cli
    out=XMLGenerator(sys.stdout if use_stdio(args.output) else open(args.output, "w")))
  File "/usr/local/lib/python3.3/site-packages/code_guide/__init__.py", line 258, in to_html
    _code_tree_to_html(out, e, code_lexer, md)
  File "/usr/local/lib/python3.3/site-packages/code_guide/__init__.py", line 142, in _code_tree_to_html
    stream_html(out, pygments.highlight(" " if e.text == "" else e.text, code_lexer, HtmlFormatter(cssclass="", classprefix="code-guide-syntax-")))
  File "/usr/local/lib/python3.3/site-packages/code_guide/__init__.py", line 125, in stream_html
    xml.sax.parseString(html_str, filter)
  File "/usr/local/Cellar/python3/3.3.1/Frameworks/Python.framework/Versions/3.3/lib/python3.3/xml/sax/__init__.py", line 45, in parseString
    inpsrc.setByteStream(BytesIO(string))
TypeError: 'str' does not support the buffer interface

Interestingly, after I re-installed Python and Pip and wanted to install code_guide again, I got this on the console:

$ pip3 install code_guide
Downloading/unpacking code-guide
  Running setup.py egg_info for package code-guide

Requirement already satisfied (use --upgrade to upgrade): markdown==2.3.1 in /usr/local/lib/python3.3/site-packages (from code-guide)
Requirement already satisfied (use --upgrade to upgrade): pygments==1.6 in /usr/local/lib/python3.3/site-packages (from code-guide)
Installing collected packages: code-guide
  Running setup.py install for code-guide
      File "/usr/local/lib/python3.3/site-packages/code_guide/test_code_guide.py", line 223
        print e
              ^
    SyntaxError: invalid syntax


    changing mode of /usr/local/share/python3/code-guide to 755
Successfully installed code-guide
Cleaning up...

-- but only once.

Errors while installing Pygments

I tried to install Pygments in a python 2.7.3 setup as a standard user (shared cluster, no root access), but it went bad and not pygmentize is also throwing an error.
The installation looks like:

$ pip install --index-url=https://pypi.python.org/simple/ --user Pygments
Downloading/unpacking Pygments
  Downloading Pygments-2.6.1.tar.gz (3.3MB): 3.3MB downloaded
  Running setup.py egg_info for package Pygments
Installing collected packages: Pygments
  Running setup.py install for Pygments
    SyntaxError: ('invalid syntax', ('/home/user/.local/lib/python2.7/site-packages/pygments/formatters/html.py', 554, 31, '                          file=sys.stderr)\n'))

    SyntaxError: ('invalid syntax', ('/home/user/.local/lib/python2.7/site-packages/pygments/lexer.py', 49, 22, 'class Lexer(metaclass=LexerMeta):\n'))

    SyntaxError: ('invalid syntax', ('/home/user/.local/lib/python2.7/site-packages/pygments/style.py', 171, 22, 'class Style(metaclass=StyleMeta):\n'))

    SyntaxError: ('invalid syntax', ('/home/user/.local/lib/python2.7/site-packages/pygments/cmdline.py', 161, 43, '        print("%s not found!" % what, file=sys.stderr)\n'))

    Installing pygmentize script to /home/user/.local/bin
  Could not find .egg-info directory in install record for Pygments
Successfully installed Pygments
Cleaning up...

And the actual error is:

$ pygmentize
Traceback (most recent call last):
  File "/home/user/.local/bin/pygmentize", line 11, in <module>
    load_entry_point('Pygments==2.6.1', 'console_scripts', 'pygmentize')()
  File "/apps/PYTHON/2.7.3/lib/python2.7/site-packages/pkg_resources/__init__.py", line 560, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/apps/PYTHON/2.7.3/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2642, in load_entry_point
    return ep.load()
  File "/apps/PYTHON/2.7.3/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2296, in load
    return self.resolve()
  File "/apps/PYTHON/2.7.3/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2302, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/user/.local/lib/python2.7/site-packages/pygments/cmdline.py", line 161
    print("%s not found!" % what, file=sys.stderr)
                                      ^
SyntaxError: invalid syntax

Any ideas why is this happening?

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.