unicode is not defined
See original GitHub issueThis line seems to be fixed, or ignored with if str is not str
, when I install 1.0.3a1 but it still seems to be in master and also in the 1.0.3a1 tagged branch. I’m using python3.3.
https://github.com/formencode/formencode/blob/master/formencode/api.py#L153 https://github.com/formencode/formencode/blob/1.3.0a1/formencode/api.py#L153
Starting subprocess with file monitor
Traceback (most recent call last):
File "../ve/bin/pserve", line 11, in <module>
sys.exit(main())
File "/home/user/workspace/project-container/myproject/ve/lib/python3.3/site-packages/pyramid/scripts/pserve.py", line 58, in main
return command.run()
File "/home/user/workspace/project-container/myproject/ve/lib/python3.3/site-packages/pyramid/scripts/pserve.py", line 328, in run
global_conf=vars)
File "/home/user/workspace/project-container/myproject/ve/lib/python3.3/site-packages/pyramid/scripts/pserve.py", line 363, in loadapp
return loadapp(app_spec, name=name, relative_to=relative_to, **kw)
File "/home/user/workspace/project-container/myproject/ve/lib/python3.3/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
return loadobj(APP, uri, name=name, **kw)
File "/home/user/workspace/project-container/myproject/ve/lib/python3.3/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
return context.create()
File "/home/user/workspace/project-container/myproject/ve/lib/python3.3/site-packages/paste/deploy/loadwsgi.py", line 710, in create
return self.object_type.invoke(self)
File "/home/user/workspace/project-container/myproject/ve/lib/python3.3/site-packages/paste/deploy/loadwsgi.py", line 146, in invoke
return fix_call(context.object, context.global_conf, **context.local_conf)
File "/home/user/workspace/project-container/myproject/ve/lib/python3.3/site-packages/paste/deploy/util.py", line 55, in fix_call
val = callable(*args, **kw)
File "/home/user/workspace/project-container/myproject/myproject/myproject/__init__.py", line 165, in main
config.scan('myproject.views')
File "/home/user/workspace/project-container/myproject/ve/lib/python3.3/site-packages/pyramid/config/__init__.py", line 930, in scan
ignore=ignore)
File "/home/user/workspace/project-container/myproject/ve/lib/python3.3/site-packages/venusian/__init__.py", line 205, in scan
__import__(modname)
File "/home/user/workspace/project-container/myproject/myproject/myproject/views/api.py", line 19, in <module>
from formencode import (
File "/home/user/workspace/project-container/myproject/ve/lib/python3.3/site-packages/formencode/__init__.py", line 3, in <module>
from formencode.api import (
File "/home/user/workspace/project-container/myproject/ve/lib/python3.3/site-packages/formencode/api.py", line 109, in <module>
class Invalid(Exception):
File "/home/user/workspace/project-container/myproject/ve/lib/python3.3/site-packages/formencode/api.py", line 153, in Invalid
if unicode is not str: # Python 2
NameError: name 'unicode' is not defined
When I install FormEncode-1.3.0a1 with pip install the code looks like this:
if str is not str: # Python 2
def __unicode__(self):
if isinstance(self.msg, str):
return self.msg
elif isinstance(self.msg, str):
return self.msg.decode('utf8')
else:
return str(self.msg)
Issue Analytics
- State:
- Created 8 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
NameError: global name 'unicode' is not defined - in Python 3
In a module in this package (algorithm.py) there are some lines that give me error, although it is part of the package. Here...
Read more >NameError: name 'unicode' is not defined in Python | bobbyhadz
The Python "NameError name 'unicode' is not defined" occurs when using the unicode object in Python 3. To solve the error, replace all...
Read more >NameError: name 'unicode' is not defined · Issue #24 - GitHub
just a very simple code : print ("first"), have issue: Traceback (most recent call last):
Read more >How to make unicode string with python3 - Intellipaat
I'm getting an error with python 3 saying... NameError: global name 'unicode' is not defined. Could you please help me to find out...
Read more >NameError: global name 'unicode' is not defined - in Python 3
PYTHON : NameError: global name ' unicode' is not defined - in Python 3 [ Gift : Animated Search Engine ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Can we have a new release (looks like 2.0.0 is in the making) because I’m hitting this issue with Python 3.4.3 in a Pyramid project. The installation off the GitHub repo seems to be working and resolve the Python 2 vs. 3 (
unicode
not defined) issue:Hey @lambacck thanks for FormEncode! Users of SQLObject on Python 3 (which relies on FormEncode) are running into this with 1.3.0. Is there any chance a new release could be made, perhaps a 1.3.1 or something? Thanks in advance!