question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Python 2.7 Django not working

See original GitHub issue

I keep getting a TypeError exception:

unicode argument expected, got 'str'

When I try to do this:

data = {'data': somedata}

    template = get_template('sometemplate.html')
    html = template.render(Context(data))
    result = StringIO()

    status = pisa.CreatePDF(StringIO(html), result)

I saw the Django example and the code is similir to this one. Any clues?

Thank you

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
juosvidicommented, Feb 11, 2016

The latest pre-release doesn’t work.

0reactions
benjaomingcommented, Apr 19, 2016

Closing this until someone gives useful input. Also, I don’t see this problem, so I suspect you’re feeding non-unicode data to CreatePDF as the error hints.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to install Django Version 1.11.22 with python 2.7 ...
The latest version Python 2.7.18 should work fine. Install it with pip enabled or install pip after using python -m ensurepip . Upgrade...
Read more >
Troubleshooting - Django documentation
This page contains some advice about errors and problems commonly encountered during the development of Django applications.
Read more >
Your First Steps With Django: Set Up a Django Project
This tutorial provides a walkthrough and a reference for starting a Django project and app. You can use it as a quick setup...
Read more >
Setting up a Django development environment - MDN Web Docs
For Django 4.0.2 the allowed versions are Python 3.8 to 3.10 (see ... This can be a problem if you want to create...
Read more >
Install Django using virtualenv - DreamHost Knowledge Base
3, you must be running Python 3. If you attempt to install in a Python 2 environment, you'll see the following errors: Could...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found