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
Accents in notebook names and in command-line (nbconvert) #4732
Conversation
filename = filename.encode('cp1252') | ||
else: | ||
filename = filename.encode('utf-8') | ||
#END_HACK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't the command be a unicode object instead of the bytestring?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are right, it should be unicode but there is a problem (bug?) when using windows and python 2.x:
http://changilkim.wordpress.com/2013/03/10/some-python-subprocess-popen-tips/
http://bugs.python.org/issue19264
I tested the subprocess.Popen in both linux and windows and the problem is only with the combination of win + python 2.X (in python 3.X is fixed).
I'll update the code for using unicode (requires a minor fix) and I'll put the hack only for win+py 2.x.
…tforms and python 2.x
""" | ||
with self.create_temp_cwd(['nb*.ipynb']): | ||
self.call('nbconvert --to latex nb1_* ' | ||
'--SphinxTransform.author="análisis"') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SphinxTransform doesn't exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's SphinxTransformer.author...I'll update this test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I just see that in master branch the latex template is not using sphinx. So this test is not valid.
times = 'time' if count == 1 else 'times' | ||
self.log.info("Running %s %i %s: %s", command_list[0], count, times, command) | ||
with open(os.devnull, 'rb') as null: | ||
stdout = subprocess.PIPE if not self.verbose else None | ||
for index in range(count): | ||
p = subprocess.Popen(command, stdout=stdout, stdin=null) | ||
p = subprocess.Popen(command, stdout=stdout, stdin=null, shell=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably shouldn't be shell=True since command is a list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you remove the shell=True
, then this should be ready for merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I didn't notice your previous comment. I'm going to update the code right now
Yep, I think is ready 👍 (btw, having the "tilde" stuff working in nbconvert is nice for my spanish named notebooks 😉, thanks!) |
Accents in notebook names and in command-line (nbconvert)
@minrk, this seems to be causing test failures on your Mac build bots. Can you investigate?
|
I'll look into it. |
@takluyver #4873 makes the test pass on my machine. |
Accents in notebook names and in command-line (nbconvert)
The Problem
Current stable version had some issues when you try to use accents in the notebook names or in the command line. I had problems with:
The two first issues are solved in the development version but the last one is still there.
The proposed solution
I added new test cases in the nbconvert test folder for testing those issues. These tests will be useful for maintaining the accents support.
I fixed the issue with the pdf postprocessor with the accents in file names. There were two problems: A mix between str and unicode characters and also an encoding problem in windows (arguments are received in cp437 from the dos console but we must use cp1252 for calling pdflatex subprocess). I saw some code that wrap subprocess.Popen calls in the IPython.utils so I guess that this fix could be implement in a better way...