Skip to content
This repository

%loadpy should cut out encoding declaration #1103

takluyver opened this Issue December 04, 2011 · 0 comments

1 participant

Thomas Kluyver
Thomas Kluyver

I noticed recently that doing %loadpy on a file with a # coding: utf-8 magic comment causes a problem, because the compiler doesn't like encoding declarations in a unicode string. We should ideally detect this, use it to correctly decode the file ourselves, and then remove the encoding declaration from the code that appears.

Example session:

In [1]: print 123

In [2]: %save 1
The following commands were written to file ``:
print 123

In [3]: %loadpy

In [4]: # coding: utf-8
   ...: print 123
  File "<ipython-input-4-8226810be253>", line 0
SyntaxError: encoding declaration in Unicode string (<ipython-input-4-8226810be253>, line 0)
Thomas Kluyver takluyver closed this in 0c6c879 December 15, 2011
Brian E. Granger ellisonbg referenced this issue from a commit January 10, 2012
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.