Syntax error in a Python library, and I'm not sure how to proceed


I'm using pyramid 1.5.1 and python 3.2, and I just added quite a bit of code and a couple libraries to my project.

On running development.ini, I'm getting the error below.

If I had to take a wild guess, I would say that this particular library (looks like Markupsafe?) isn't compatible with Python3...but the project page seems to indicate that it is. Problem is, I'm not calling this library directly, it's being used by another library that would be very difficult to replace.

I'm new to Python programming, and I was wondering what my options are here Or what the best way to debug is?

(finance-env)user1@finance1:/var/www/finance/corefinance/corefinance$ /var/www/finance/finance-env/bin/pserve /var/www/finance/corefinance/development.ini --reload Starting subprocess with file monitor Traceback (most recent call last): File "/var/www/finance/finance-env/bin/pserve", line 9, in <module> load_entry_point('pyramid==1.5.1', 'console_scripts', 'pserve')() File "/var/www/finance/finance-env/lib/python3.2/site-packages/pyramid/scripts/pserve.py", line 51, in main return command.run() File "/var/www/finance/finance-env/lib/python3.2/site-packages/pyramid/scripts/pserve.py", line 316, in run global_conf=vars) File "/var/www/finance/finance-env/lib/python3.2/site-packages/pyramid/scripts/pserve.py", line 340, in loadapp return loadapp(app_spec, name=name, relative_to=relative_to, **kw) File "/var/www/finance/finance-env/lib/python3.2/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp return loadobj(APP, uri, name=name, **kw) File "/var/www/finance/finance-env/lib/python3.2/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj return context.create() File "/var/www/finance/finance-env/lib/python3.2/site-packages/paste/deploy/loadwsgi.py", line 710, in create return self.object_type.invoke(self) File "/var/www/finance/finance-env/lib/python3.2/site-packages/paste/deploy/loadwsgi.py", line 146, in invoke return fix_call(context.object, context.global_conf, **context.local_conf) File "/var/www/finance/finance-env/lib/python3.2/site-packages/paste/deploy/util.py", line 55, in fix_call val = callable(*args, **kw) File "/var/www/finance/corefinance/corefinance/__init__.py", line 35, in main session_factory=session_factory File "/var/www/finance/finance-env/lib/python3.2/site-packages/pyramid/config/__init__.py", line 301, in __init__ exceptionresponse_view=exceptionresponse_view, File "/var/www/finance/finance-env/lib/python3.2/site-packages/pyramid/config/__init__.py", line 412, in setup_registry self.include(inc) File "/var/www/finance/finance-env/lib/python3.2/site-packages/pyramid/config/__init__.py", line 755, in include c(configurator) File "/var/www/finance/finance-env/lib/python3.2/site-packages/pyramid_debugtoolbar-2.1-py3.2.egg/pyramid_debugtoolbar/__init__.py", line 113, in includeme config.include('pyramid_mako') File "/var/www/finance/finance-env/lib/python3.2/site-packages/pyramid/config/__init__.py", line 727, in include c = self.maybe_dotted(callable) File "/var/www/finance/finance-env/lib/python3.2/site-packages/pyramid/config/__init__.py", line 825, in maybe_dotted return self.name_resolver.maybe_resolve(dotted) File "/var/www/finance/finance-env/lib/python3.2/site-packages/pyramid/path.py", line 320, in maybe_resolve return self._resolve(dotted, package) File "/var/www/finance/finance-env/lib/python3.2/site-packages/pyramid/path.py", line 327, in _resolve return self._zope_dottedname_style(dotted, package) File "/var/www/finance/finance-env/lib/python3.2/site-packages/pyramid/path.py", line 370, in _zope_dottedname_style found = __import__(used) File "/var/www/finance/finance-env/lib/python3.2/site-packages/pyramid_mako-1.0.2-py3.2.egg/pyramid_mako/__init__.py", line 18, in <module> from mako.lookup import TemplateLookup File "/var/www/finance/finance-env/lib/python3.2/site-packages/Mako-1.0.0-py3.2.egg/mako/lookup.py", line 9, in <module> from mako.template import Template File "/var/www/finance/finance-env/lib/python3.2/site-packages/Mako-1.0.0-py3.2.egg/mako/template.py", line 10, in <module> from mako.lexer import Lexer File "/var/www/finance/finance-env/lib/python3.2/site-packages/Mako-1.0.0-py3.2.egg/mako/lexer.py", line 11, in <module> from mako import parsetree, exceptions, compat File "/var/www/finance/finance-env/lib/python3.2/site-packages/Mako-1.0.0-py3.2.egg/mako/parsetree.py", line 9, in <module> from mako import exceptions, ast, util, filters, compat File "/var/www/finance/finance-env/lib/python3.2/site-packages/Mako-1.0.0-py3.2.egg/mako/filters.py", line 38, in <module> import markupsafe File "/var/www/finance/finance-env/lib/python3.2/site-packages/MarkupSafe-0.23-py3.2-linux-x86_64.egg/markupsafe/__init__.py", line 70 def __new__(cls, base=u'', encoding=None, errors='strict'): ^ SyntaxError: invalid syntax


The MarkupSafe package uses syntax only supported by Python 3.3 and up. Python 3.2 is not supported anymore as of <a href="https://github.com/mitsuhiko/markupsafe/blob/master/CHANGES#L14-L18" rel="nofollow">version 0.16</a>.

The u'unicode' literal syntax was introduced in <a href="https://docs.python.org/3/whatsnew/3.3.html#pep-414-explicit-unicode-literals" rel="nofollow">PEP 414</a> to make it easier to create library code that can support both Python 2 and 3.

Either upgrade to Python 3.3 (or 3.4 even), or downgrade MarkupSafe to 0.15, the last version to support Python 3.2.

I do see that <a href="https://bitbucket.org/zzzeek/mako/commits/4acc7ecaafdc1c36602d3ed7c02892c04210de13" rel="nofollow">Mako <em>removes</em> the MarkupSafe dependency</a> when you are using Python 3.2; if nothing else depends on it is perhaps safe to remove the package altogether. The <a href="https://bitbucket.org/zzzeek/mako/src/285bc818a50ccc0f9549630f7c4f4c250585c3e7/mako/filters.py?at=master#cl-37" rel="nofollow">mako.filter source code</a> certainly will fall back to a local implementation if the package is not installed.


  • Using QProcess.finished() in Python 3 and PyQt
  • How to install PyAutoGUI
  • import error with python-mysql-connector 1.16, django 1.6, and python 3.2.3
  • Error while importing scikits.talkbox
  • Why is django manage.py syncdb failing to create new columns on my development server?
  • py4j.protocol.Py4JJavaError when selecting nested column in dataframe using select statetment
  • python: forcing relative imports to search from script file
  • Python 3.2.2, error(scripts to exe)
  • PHP Listener Script for Paypal Webhooks
  • php script is parsing content from RTE (tt_news) but internal links are not appearing as speaking ur
  • How to pass a value from ASP.NET MVC controller to ASP.NET webforms control inside MVC View?
  • How to get latest version of a artifact on Bintray using JSONP
  • During installation of Django, why do I keep getting ImportError: No module named django?
  • pillow imaging ImportError
  • Problems installing Yesod for Haskell
  • error importing numpy
  • Django simple Captcha “No module named fields” error
  • How to know when stdin is empty if it contains EOF?
  • Very simple C++ DLL that can be called from .net
  • Test if a set exists before trying to drop it
  • All Classes Conforming to Protocol Inherit Default Implementation
  • Jenkins: How To Build multiple projects from a TFS repository?
  • How do I fake an specific browser client when using Java's Net library?
  • output of program is not same as passed argument
  • Cross-Platform Protobuf Serialization
  • Websockets service method fails during R startup
  • Apache 2.4 - remove | delete | uninstall
  • Akka Routing: Reply's send to router ends up as dead letters
  • SVN: Merging two branches together
  • Hibernate gives error error as “Access to DialectResolutionInfo cannot be null when 'hibernate.
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Can Visual Studio XAML designer handle font family names with spaces as a resource?
  • unknown Exception android
  • Append folder name and increment by 1 using batch script
  • Checking variable from a different class in C#
  • Django query for large number of relationships
  • Why is Django giving me: 'first_name' is an invalid keyword argument for this function?
  • How can I use `wmic` in a Windows PE script?
  • How to push additional view controllers onto NavigationController but keep the TabBar?