Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

не читаются новые файлы #5

Open
gpashchenko opened this issue Jan 5, 2020 · 3 comments
Open

не читаются новые файлы #5

gpashchenko opened this issue Jan 5, 2020 · 3 comments

Comments

@gpashchenko
Copy link

Пытаюсь прочитать qsh файлы. Все работает на примерах, но для новых файлов, например, AFKS.2020-01-03.Quotes.qsh отсюда http://erinrv.qscalp.ru/2020-01-03/ не работает. В чем может быть ошибка? Спасибо за помощь!

Traceback ниже:


UnicodeDecodeError Traceback (most recent call last)
in
----> 1 q.touch()

~\Documents\temp\dataa\qsh_parser\qsh_parser.py in touch(self)
692 """
693 if self._stream_dt is None:
--> 694 self._header.read(self._io_stream)
695 if self._header.data.get('stream_count') > 1:
696 _msg = 'More than one stream in file {}'.format(self._stream.name)

~\Documents\temp\dataa\qsh_parser\qsh_parser.py in read(self, stream)
520 for key in ['_format_version', '_app_name', '_user_comment',
521 '_record_start_time', '_stream_count']:
--> 522 getattr(self, key).value = getattr(self, key).read(stream)
523
524 self._head_len = stream.tell()

~\Documents\temp\dataa\qsh_parser\qsh_parser.py in read_string(self, stream)
174 - uleb128 - длинна массива - число бит для чтения
175 """
--> 176 return bytes.decode(stream.read(self.read_uleb(stream)))
177
178

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd8 in position 0: invalid continuation byte

@AndrewKhodyakov
Copy link
Owner

AndrewKhodyakov commented Jan 5, 2020

Доброго времени суток, хмм выглядит как попытка почитать файл в кодировке cp1251 или koi8. Надо исследовать этот момент.

@AbramJenkingarten
Copy link

Traceback (most recent call last):
File "99test-qsh.py", line 8, in
f.touch() #чтение заголовка файла
File "/venv/qsh_parser/qsh_parser.py", line 694, in touch
self._header.read(self._io_stream)
File "/venv/qsh_parser/qsh_parser.py", line 522, in read
getattr(self, key).value = getattr(self, key).read(stream)
File "/venv/qsh_parser/qsh_parser.py", line 176, in read_string
return bytes.decode(stream.read(self.read_uleb(stream)))
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x9c in position 20: invalid start byte

Исследования продвинулись?

@wind3style
Copy link

Traceback (most recent call last):
File "99test-qsh.py", line 8, in
f.touch() #чтение заголовка файла
File "/venv/qsh_parser/qsh_parser.py", line 694, in touch
self._header.read(self._io_stream)
File "/venv/qsh_parser/qsh_parser.py", line 522, in read
getattr(self, key).value = getattr(self, key).read(stream)
File "/venv/qsh_parser/qsh_parser.py", line 176, in read_string
return bytes.decode(stream.read(self.read_uleb(stream)))
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x9c in position 20: invalid start byte

Исследования продвинулись?

Я столкнулся с аналогичной проблемой, час не мог понять почему по F3 в mc я вижу заголовок "QScalp History Data", а парсер читает мусор.
Оказалось файл запакован через gzip без изменения расширения. Умный mc при просмотре сам его распаковывал, а парсер естественно нет.
Решение: Добавить к файлу расширение .gz и распаковать через gunzip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants