title: How to fix ''PosixPath' object has no attribute 'encode'" error using librosa.load?
body: <p>I'm starting learning basic feature extraction with librosa and was trying reading and storing ten kick drums with pathlib, but it doesn't work since I always getting an encoding error, where as there is no error without pathlib.</p>
  
  <p>I tried changing the path, updating every imported library very often, using wav instead of mp3 but had no further idea.</p>
  
  <p>My code:</p>
  
  <pre><code>%matplotlib inline
  from pathlib import Path
  import numpy, scipy, matplotlib.pyplot as plt, sklearn, urllib, IPython.display as ipd
  import librosa, librosa.display
  </code></pre>
  
  <pre><code>kick_signals = [
      librosa.load(p)[0] for p in Path().glob('audio/drum_samples/train/kick_*.mp3')
  ]
  </code></pre>
  
  <p>Error messages:</p>
  
  <pre><code>RuntimeError: Error opening 'audio/techno-nine_o_three.mp3': File contains data in an unknown format.
  </code></pre>
  
  <p>and </p>
  
  <pre><code>AttributeError: 'PosixPath' object has no attribute 'encode'
  </code></pre>
  
  <p>I would be very thankful, if you would and could help me.</p>