You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Try to open it with pydub.AudioSegment.from_file(filename)
Expected behavior
File can be opened.
Actual behavior
In [2]: segment=AudioSegment.from_file('-you-can\'t-open-this.flac')
---------------------------------------------------------------------------JSONDecodeErrorTraceback (mostrecentcalllast)
CellIn[2], line1---->1segment=AudioSegment.from_file('-you-can\'t-open-this.flac')
File/usr/lib/python3.11/site-packages/pydub/audio_segment.py:728, inAudioSegment.from_file(cls, file, format, codec, parameters, start_second, duration, **kwargs)
726info=None727else:
-->728info=mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit)
729ifinfo:
730audio_streams= [xforxininfo['streams']
731ifx['codec_type'] =='audio']
File/usr/lib/python3.11/site-packages/pydub/utils.py:279, inmediainfo_json(filepath, read_ahead_limit)
276output=output.decode("utf-8", 'ignore')
277stderr=stderr.decode("utf-8", 'ignore')
-->279info=json.loads(output)
281ifnotinfo:
282# If ffprobe didn't give any information, just return it283# (for example, because the file doesn't exist)284returninfoFile/usr/lib/python3.11/json/__init__.py:346, inloads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
341s=s.decode(detect_encoding(s), 'surrogatepass')
343if (clsisNoneandobject_hookisNoneand344parse_intisNoneandparse_floatisNoneand345parse_constantisNoneandobject_pairs_hookisNoneandnotkw):
-->346return_default_decoder.decode(s)
347ifclsisNone:
348cls=JSONDecoderFile/usr/lib/python3.11/json/decoder.py:337, inJSONDecoder.decode(self, s, _w)
332defdecode(self, s, _w=WHITESPACE.match):
333"""Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 """-->337obj, end=self.raw_decode(s, idx=_w(s, 0).end())
338end=_w(s, end).end()
339ifend!=len(s):
File/usr/lib/python3.11/json/decoder.py:355, inJSONDecoder.raw_decode(self, s, idx)
353obj, end=self.scan_once(s, idx)
354exceptStopIterationaserr:
-->355raiseJSONDecodeError("Expecting value", s, err.value) fromNone356returnobj, endJSONDecodeError: Expectingvalue: line1column1 (char0)
Your System configuration
Python version: 3.11.6
Pydub version: 0.25.1
ffmpeg or avlib?: ffmpeg
ffmpeg/avlib version: 2:6.1-3
The text was updated successfully, but these errors were encountered:
nukemiko
changed the title
Cannot open files whose file names begin with a minus sign -
Cannot open files whose file names begin with dash -Dec 19, 2023
Steps to reproduce
-
pydub.AudioSegment.from_file(filename)
Expected behavior
File can be opened.
Actual behavior
Your System configuration
The text was updated successfully, but these errors were encountered: