jupytext icon indicating copy to clipboard operation
jupytext copied to clipboard

odd behaviour when using a file object

Open parmentelat opened this issue 1 year ago • 0 comments

I had a piece of code that read

            with open(self.filename) as f:
                self.notebook = jupytext.read(f)

the odd thing is, this kind of worked on some input notebooks, but not all, and occasionnally it did return something with the cell types wrong, and other incongruities

I was able to return to a perfectly normal behaviour by rewriting this as simply

            self.notebook = jupytext.read(self.filename)

I have not checked what the docs say exactly; but given that it 'almost works', going to the docs was not at all my first inclination in this instance, so I am thinking, maybe having the code issue some kind of warning here might spare others the same puzzle I had to solve

no big deal at all I am reporting this also - mostly - because I am curious to know how such a behaviour is even possible ;-)


if that's of any interest:

  • I was getting an OK behaviour with https://github.com/ue12-p22/git/blob/446254f136541ad7c330d92c6971e06bf97eb356/notebooks/1-01-git-local.md
  • but the odd one with https://github.com/ue12-p22/git/blob/446254f136541ad7c330d92c6971e06bf97eb356/notebooks/1-00-intro.md

but this is third order at least, feel free to ignore completely

parmentelat avatar Sep 12 '22 12:09 parmentelat