ranger-tools's Introduction
ranger-tools's People
ranger-tools's Issues
Two tests fail
For running unit tests:
python -m unittest
I receive an output:
E...............E
======================================================================
ERROR: test_buffer (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_buffer
Traceback (most recent call last):
File "/home/jry/.pyenv/versions/3.10.9/lib/python3.10/unittest/loader.py", line 436, in _find_test_path
module = self._get_module_from_name(name)
File "/home/jry/.pyenv/versions/3.10.9/lib/python3.10/unittest/loader.py", line 377, in _get_module_from_name
__import__(name)
File "/home/jry/source/ranger-tools/test/test_buffer.py", line 7, in <module>
from rangers.std._buffer import Buffer as _Buffer, IBuffer as _IBuffer, OBuffer as _OBuffer
ModuleNotFoundError: No module named 'rangers.std._buffer'
======================================================================
ERROR: test_dat (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_dat
Traceback (most recent call last):
File "/home/jry/.pyenv/versions/3.10.9/lib/python3.10/unittest/loader.py", line 436, in _find_test_path
module = self._get_module_from_name(name)
File "/home/jry/.pyenv/versions/3.10.9/lib/python3.10/unittest/loader.py", line 377, in _get_module_from_name
__import__(name)
File "/home/jry/source/ranger-tools/test/test_dat.py", line 89, in <module>
from rangers.std.buffer import Buffer, FastBuffer
ImportError: cannot import name 'FastBuffer' from 'rangers.std.buffer' (/home/jry/source/ranger-tools/rangers/std/buffer.py)
----------------------------------------------------------------------
Ran 17 tests in 0.002s
FAILED (errors=2)
Can you fix that?
Missing byteorder parameter
I am trying to read lang.dat
using the DAT.from_file
method. This call will subsequently fails with the error:
TypeError: from_bytes() missing required argument 'byteorder' (pos 2)
Full stack
Traceback (most recent call last):
File "/home/jry/source/SRHD-lang-dat-translate/python/app.py", line 8, in <module>
rangers.dat.DAT.from_file(dat_file_path)
File "/home/jry/source/SRHD-lang-dat-translate/.venv/lib/python3.10/site-packages/rangers/dat.py", line 311, in from_file
return cls.from_dat(path)
File "/home/jry/source/SRHD-lang-dat-translate/.venv/lib/python3.10/site-packages/rangers/dat.py", line 263, in from_dat
return cls.from_bytes(data, fmt=fmt)
File "/home/jry/source/SRHD-lang-dat-translate/.venv/lib/python3.10/site-packages/rangers/dat.py", line 222, in from_bytes
).read_bytes(data)
File "/home/jry/source/SRHD-lang-dat-translate/.venv/lib/python3.10/site-packages/rangers/std/dataclass.py", line 302, in read_bytes
return self.read_with_memo(IBuffer(data), memo)
File "/home/jry/source/SRHD-lang-dat-translate/.venv/lib/python3.10/site-packages/rangers/std/dataclass.py", line 313, in read_with_memo
result = self.read(buf)
File "/home/jry/source/SRHD-lang-dat-translate/.venv/lib/python3.10/site-packages/rangers/std/dataclass.py", line 973, in read
data = self.dcls1.read(buf)
File "/home/jry/source/SRHD-lang-dat-translate/.venv/lib/python3.10/site-packages/rangers/std/dataclass.py", line 1167, in read
data = self.bytes_xor(data1, data2)
File "/home/jry/source/SRHD-lang-dat-translate/.venv/lib/python3.10/site-packages/rangers/std/dataclass.py", line 1145, in bytes_xor
return (int.from_bytes(d1) ^ int.from_bytes(d2)).to_bytes(max(len(d1), len(d2)))
TypeError: from_bytes() missing required argument 'byteorder' (pos 2)
Missing Licence
I'd like to use your library for non-commercial purposes. Can you please add a licence?
Can't open some Lang.Dat files
I can't open some DAT files because of encryption keys. What is that?
Example:
import rangers.dat
import pathlib
dat_file = pathlib.Path('xxx/Space Rangers HD A War Apart/Mods/Evolution/EvoBalance/CFG/Rus/Lang.dat')
rangers.dat.DAT.from_dat(dat_file).to_dict()
AssertionError Traceback (most recent call last)
File ~/source/SRHD-lang-dat-translate/.venv/lib/python3.10/site-packages/rangers/dat.py:263, in DAT.from_dat(cls, path, fmt)
261 with open(path, 'rb') as file:
262 data = file.read()
--> 263 return cls.from_bytes(data, fmt=fmt)
File ~/source/SRHD-lang-dat-translate/.venv/lib/python3.10/site-packages/rangers/dat.py:217, in DAT.from_bytes(cls, data, fmt)
215 if fmt not in ENCRYPTION_KEYS:
216 fmt = guess_format(data)
--> 217 assert fmt is not None
218 assert fmt in ENCRYPTION_KEYS, f'Invalid dat format: {fmt}'
219 data_d = Nested(
220 CryptedRand31pm(key=ENCRYPTION_KEYS[fmt]),
221 ZL(mode=1, length=-1),
222 ).read_bytes(data)
AssertionError:
When I try to set fmt
manaully, it breaks. With different exception saying
ValueError: Content hash 0x19884d4a dont match actual hash 0x2d6a337f
I am not sure if the problem is in the data or in the library. Since this Lang.dat can get open within the game itself, I would guess that it somehting with this library.
Can you help me?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.