TypeError: Note must be text (unicode) whith python 3.5

108 views
Skip to first unread message

Antonio Fregoso

unread,
Nov 17, 2016, 6:40:05 PM11/17/16
to TurboGears

I installed turbogears in python3.5 whith mako templates and when I try to run it under apache Turbogears it sends me the following error

TypeError: Note must be text (unicode)

  • File "/home/reginavictoria/tg2env/lib/python3.5/site-packages/tg/wsgiapp.py", line 120, in __call__

    response = self.wrapped_dispatch(controller, environ, context)
  • File "/home/reginavictoria/tg2env/lib/python3.5/site-packages/tg/appwrappers/errorpage.py", line 56, in __call__

    resp = self.next_handler(controller, environ, context)
  • File "/home/reginavictoria/tg2env/lib/python3.5/site-packages/tg/appwrappers/transaction_manager.py", line 107, in __call__

    reraise(*exc_info)
  • File "/home/reginavictoria/tg2env/lib/python3.5/site-packages/tg/appwrappers/transaction_manager.py", line 81, in __call__

    t.note(environ.get('PATH_INFO', ''))
  • File "/home/reginavictoria/tg2env/lib/python3.5/site-packages/transaction/_transaction.py", line 537, in note

    raise TypeError("Note must be text (unicode)")


Thank you in advance for your help :-)


Antonio Fregoso

unread,
Nov 18, 2016, 2:23:20 PM11/18/16
to TurboGears
Is the same with python 3.4

  • File "/home/reginavictoria/tg2env/lib/python3.4/site-packages/tg/wsgiapp.py", line 120, in __call__

  • response = self.wrapped_dispatch(controller, environ, context)
  • File "/home/reginavictoria/tg2env/lib/python3.4/site-packages/tg/appwrappers/errorpage.py", line 56, in __call__

  • resp = self.next_handler(controller, environ, context)
  • File "/home/reginavictoria/tg2env/lib/python3.4/site-packages/tg/appwrappers/transaction_manager.py", line 107, in __call__

    reraise(*exc_info)
  • File "/home/reginavictoria/tg2env/lib/python3.4/site-packages/tg/appwrappers/transaction_manager.py", line 81, in __call__

    t.note(environ.get('PATH_INFO', ''))
  • File "/home/reginavictoria/tg2env/lib/python3.4/site-packages/transaction/_transaction.py", line 537, in note

  • raise TypeError("Note must be text (unicode)")
TypeError: Note must be text (unicode)

Alessandro Molina

unread,
Nov 19, 2016, 6:08:37 AM11/19/16
to TurboGears
On Fri, Nov 18, 2016 at 12:40 AM, Antonio Fregoso <antonio.f...@gmail.com> wrote:

I installed turbogears in python3.5 whith mako templates and when I try to run it under apache Turbogears it sends me the following error
Thanks for reporting, how are you running it? Is it through mod_wsgi? Which version of apache and mod_wsgi?

It seems the PATH is provided as bytes in violation with WSGI 3333 where it's stated it should be a "native string", so an unicode on Python 3.X:

 - "Native strings (which are always implemented using the type named str ) that are used for request/response headers and metadata" 
 - "that CGI-defined variables must be native strings, if they are present at all. It is a violation of this specification for any CGI variable's value to be of any type other than str ."

I wouldn't expect mod_wsgi doing something wrong as the WSGI proposal it's pretty much based on it, but it might be some old version.
Are you doing anything particular to reproduce the issue or just starting the App and doing any request is enough? 

Antonio Fregoso

unread,
Nov 22, 2016, 10:24:45 PM11/22/16
to TurboGears

Tanks Allessandro:

The server is virtual Ubuntu 16 on Amazon with Apache2. I tried on a virtual server siimilar on my laptop and had the same problem.
Reinstall the previous version of TurboGears and it worked without problems.

Regards

Raj

unread,
Nov 25, 2016, 2:15:51 AM11/25/16
to TurboGears
The same error is appearing in a newly quickstarted project also.
Using Python 2.7 on Ununtu.

Raj

unread,
Nov 25, 2016, 2:17:33 AM11/25/16
to TurboGears

Raj

unread,
Nov 25, 2016, 2:20:42 AM11/25/16
to TurboGears
To reproduce:
$ virtualenv tgtest -ppython2.7 --no-site-packages
$ cd tgtest 
$ source bin/activate
$ pip install tg.devtools
$ gearbox quickstart tgproject
$ cd tgproject
$ pip install -e
$ gearbox serve

Alessandro Molina

unread,
Nov 25, 2016, 8:51:41 AM11/25/16
to TurboGears
While I still need to investigate why the webserver provides PATH_INFO as bytes. 
The issue itself can be solved by downgrading "transaction" module to 2.0.2, this was a check introduced in 2.0.3 and practically the only change, so downgrading transaction module will fix the issue while retaining same features.

--
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email to turbogears+unsubscribe@googlegroups.com.
To post to this group, send email to turbo...@googlegroups.com.
Visit this group at https://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.

Raj

unread,
Nov 25, 2016, 11:11:39 PM11/25/16
to TurboGears
Thanks for providing the solution


On Friday, November 25, 2016 at 7:21:41 PM UTC+5:30, Alessandro Molina wrote:
While I still need to investigate why the webserver provides PATH_INFO as bytes. 
The issue itself can be solved by downgrading "transaction" module to 2.0.2, this was a check introduced in 2.0.3 and practically the only change, so downgrading transaction module will fix the issue while retaining same features.
On Fri, Nov 25, 2016 at 8:15 AM, Raj <www.r...@gmail.com> wrote:
The same error is appearing in a newly quickstarted project also.
Using Python 2.7 on Ununtu.


On Wednesday, November 23, 2016 at 8:54:45 AM UTC+5:30, Antonio Fregoso wrote:

Tanks Allessandro:

The server is virtual Ubuntu 16 on Amazon with Apache2. I tried on a virtual server siimilar on my laptop and had the same problem.
Reinstall the previous version of TurboGears and it worked without problems.

Regards

--
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email to turbogears+...@googlegroups.com.

Antonio Fregoso

unread,
Nov 27, 2016, 11:36:13 PM11/27/16
to TurboGears


Thanks Alessandro :-)

Alessandro Molina

unread,
Dec 4, 2016, 11:03:50 AM12/4/16
to TurboGears
This should have been resolved in newly released 2.3.10

On Mon, Nov 28, 2016 at 5:36 AM, Antonio Fregoso <antonio.f...@gmail.com> wrote:


Thanks Alessandro :-)

--
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email to turbogears+unsubscribe@googlegroups.com.

Antonio Fregoso

unread,
Dec 4, 2016, 10:06:12 PM12/4/16
to TurboGears
Thank you very much Alessandro. 

I already tested it and it works perfectly.
Greetings from Mexico
Reply all
Reply to author
Forward
0 new messages