New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnicodeDecodeError in utils.log_pprint #123

Closed
mbertheau opened this Issue Jan 16, 2014 · 2 comments

Comments

Projects
None yet
2 participants
@mbertheau

mbertheau commented Jan 16, 2014

In a factory I have a LazyAttribute like this:

    category = LazyAttribute(lambda o: Category.objects.get(pk=1))

__unicode__ of the Category contains non-ASCII characters. When I use the factory in a test I get

File "/home/markus/.virtualenvs/factory-bug/local/lib/python2.7/site-packages/factory/containers.py", line 85, in __fill__
  self.__log_ctx, utils.log_pprint(kwargs=res),
File "/home/markus/.virtualenvs/factory-bug/local/lib/python2.7/site-packages/factory/utils.py", line 103, in log_pprint
  ['%s=%r' % item for item in kwargs.items()]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 21: ordinal not in range(128)

A working test case is available on https://github.com/mbertheau/factory-boy-reproduce. Check it out, run pip install -r requirements.txt and then ./showbug.sh.

mbertheau/factory-boy-reproduce@a38811f are the relevant code changes to the bare django project.

@rbarrois

This comment has been minimized.

Show comment
Hide comment
@rbarrois

rbarrois Jan 16, 2014

Member

Hi,

Thanks for the report!

Looks like a bug in the debug code that doesn't handle non-ascii properly.

On which python version do you get this error?

I'll look into it this evening, thanks a lot for the very accurate bug report and test case!

Member

rbarrois commented Jan 16, 2014

Hi,

Thanks for the report!

Looks like a bug in the debug code that doesn't handle non-ascii properly.

On which python version do you get this error?

I'll look into it this evening, thanks a lot for the very accurate bug report and test case!

@mbertheau

This comment has been minimized.

Show comment
Hide comment
@mbertheau

mbertheau Jan 16, 2014

This is python 2.7.5 on Ubuntu 13.10.

Thanks for looking into this :)

mbertheau commented Jan 16, 2014

This is python 2.7.5 on Ubuntu 13.10.

Thanks for looking into this :)

@rbarrois rbarrois closed this in f907c40 Jan 21, 2014

rbarrois added a commit that referenced this issue Jan 21, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment