Skip to content
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

Anaconda3 Jupyter Notebook raises AttributeError #1441

Closed
JasonSanchez opened this issue Sep 22, 2016 · 2 comments
Closed

Anaconda3 Jupyter Notebook raises AttributeError #1441

JasonSanchez opened this issue Sep 22, 2016 · 2 comments
Labels
Milestone

Comments

@JasonSanchez
Copy link

JasonSanchez commented Sep 22, 2016

What I am using:
Jupyter Notebook (most recent Anaconda3 release).
Python 3.5.2 |Anaconda custom (x86_64)| (default, Jul 2 2016, 17:52:12)
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin

Code:
from mr_word_count import MRWordFrequencyCount
mr_job = MRWordFrequencyCount(args=['my_file.txt'])

Issue:
Works in command line/.py script. Does not work in notebook.

Error in notebook:
`---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
in ()
2 from mr_word_count import MRWordFrequencyCount
3
----> 4 mr_job = MRWordFrequencyCount(args=['my_file.txt'])
5
6 with mr_job.make_runner() as runner:

/Users/anaconda/lib/python3.5/site-packages/mrjob/job.py in init(self, args)
97 python -m mrjob.job --help
98 """
---> 99 super(MRJob, self).init(self.mr_job_script(), args)
100
101 @classmethod

/Users/anaconda/lib/python3.5/site-packages/mrjob/launch.py in init(self, script_path, args, from_cl)
126 else:
127 self.stdin = sys.stdin.buffer
--> 128 self.stdout = sys.stdout.buffer
129 self.stderr = sys.stderr.buffer
130

AttributeError: 'OutStream' object has no attribute 'buffer'`

@coyotemarin
Copy link
Collaborator

Huh, looks like stdout and stderr are ipykernel.iostream.OutStream objects, which don't have a buffer attribute, but which seem perfectly happy to accept bytes as well as unicode.

I think I'll rewrite this code to look for the buffer attribute explicitly, rather than keying off Python version.

@coyotemarin coyotemarin self-assigned this Sep 23, 2016
@coyotemarin coyotemarin added this to the v0.5.7 milestone Sep 23, 2016
coyotemarin pushed a commit that referenced this issue Sep 23, 2016
@coyotemarin coyotemarin removed their assignment Sep 23, 2016
@coyotemarin
Copy link
Collaborator

This should be fixed in master. Please try it out and let me know if it works for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants