title: Dependency between "Session/line number was not unique in database." error and Python code
body: <p>For some time I am getting the following error (warning?):</p>
  
  <blockquote>
    <p>ERROR! Session/line number was not unique in database. History logging moved to new session </p>
  </blockquote>
  
  <p>when working with Jupyter notebook (<code>&lt;XXXX&gt;</code> is a number, e.g. 9149).
  As the same error has been reported for Spyder (<a href="https://stackoverflow.com/questions/35986087/spyders-warning-session-line-number-not-unique-in-database">Spyder&#39;s Warning: &quot;Session/line number not unique in database&quot;</a>) my guess is that there is some problem with the IPython kernel logging.</p>
  
  <p>The question is: may there be any relation between running my code and the error?</p>
  
  <p><strong>Is it likely the error is caused by my code?</strong> I touch IPython API as following:</p>
  
  <pre><code>import IPython 
  
  def beep():
      Python.display.display(IPython.display.Audio(url="http://www.w3schools.com/html/horse.ogg", autoplay=True))
  
  def play_sound(self, etype, value, tb, tb_offset=None):
      self.showtraceback((etype, value, tb), tb_offset=tb_offset)
      beep()
  
  get_ipython().set_custom_exc((Exception,), play_sound)
  </code></pre>
  
  <p>I use the <code>beep()</code> function in my code. I also work with large data which results in <code>MemoryError</code> exceptions.</p>
  
  <p>And more importantly, <strong>may the error affect my code behaviour</strong> (given I do not try to access the logs)?</p>
  
  <p>[EDIT]
  It seems the issue is different than <a href="https://stackoverflow.com/questions/35986087/spyders-warning-session-line-number-not-unique-in-database">Spyder&#39;s Warning: &quot;Session/line number not unique in database&quot;</a> as I am able to reproduce it with Jupyter Notebook but not with Spyder.</p>