Git Product home page Git Product logo

Comments (9)

align4 avatar align4 commented on June 26, 2024

same, + the following when trying to list

Traceback (most recent call last):
  File "u4pak.py", line 1720, in <module>
    main(sys.argv[1:])
  File "u4pak.py", line 1609, in main
    pak = read_index(stream,args.check_integrity)
  File "u4pak.py", line 792, in read_index
    mount_point = read_path(stream)
  File "u4pak.py", line 538, in read_path
    return stream.read(path_len).rstrip(b'\0').decode('utf-8').replace('/',os.path.sep)
OverflowError: cannot fit 'int' into an index-sized integer

from u4pak.

panzi avatar panzi commented on June 26, 2024

I somehow missed the first report: I cannot reproduce that on Linux with Python 3.7.3.
For the second: That is strange. Maybe the file is damaged or in some (sub-)format I don't know about or I have a bug that somehow only gets triggered by your file. Please rewrite the read_path() function on line 536 like this and tell me what the new output is:

def read_path(stream):
	path_len, = st_unpack('<I',stream.read(4))
	print(path_len)
	print(stream.read(8).rstrip(b'\0').decode('utf-8'))
	stream.seek(-8, 1)
	return stream.read(path_len).rstrip(b'\0').decode('utf-8').replace('/',os.path.sep)

from u4pak.

rulesless avatar rulesless commented on June 26, 2024

I somehow missed the first report: I cannot reproduce that on Linux with Python 3.7.3.
For the second: That is strange. Maybe the file is damaged or in some (sub-)format I don't know about or I have a bug that somehow only gets triggered by your file. Please rewrite the read_path() function on line 536 like this and tell me what the new output is:

def read_path(stream):
	path_len, = st_unpack('<I',stream.read(4))
	print(path_len)
	print(stream.read(8).rstrip(b'\0').decode('utf-8'))
	stream.seek(-8, 1)
	return stream.read(path_len).rstrip(b'\0').decode('utf-8').replace('/',os.path.sep)

Before was
Traceback (most recent call last): File u4pak.py, line 1743, in <module> main(sys.argv[1:]) File u4pak.py, line 1618, in main if args.command == 'list': AttributeError: 'Namespace' object has no attribute 'command'

And now
Traceback (most recent call last): File u4pak.py, line 1743, in <module> main(sys.argv[1:]) File u4pak.py, line 1618, in main if args.command == 'list': AttributeError: 'Namespace' object has no attribute 'command'

from u4pak.

panzi avatar panzi commented on June 26, 2024

Wait, how do you call the program?

from u4pak.

panzi avatar panzi commented on June 26, 2024

I just figured out that you get that error message if you don't pass any arguments to u4pak.py. I fixed it so that it will print the help message in that case.

from u4pak.

rulesless avatar rulesless commented on June 26, 2024

I just figured out that you get that error message if you don't pass any arguments to u4pak.py. I fixed it so that it will print the help message in that case.

Thanks
`
C:\MOD>u4pak.py pack file.pak folder
usage: u4pak.py [-h] command ...

unpack, list and mount Unreal Engine 4 .pak archives

positional arguments:
command
unpack (x)
unpack archive
pack (c) pack archive
list (l) list archive contens
info (i) print archive summary info
test (t) test archive integrity
mount (m)
fuse mount archive

optional arguments:
-h, --help show this help message and exit
`

from u4pak.

panzi avatar panzi commented on June 26, 2024

It prints that help message for you when you try to pack a folder? Weird, it doesn't for me. Sorry, I don't have Windows, so I can't reproduce that problem. :(

panzi@panzi tmp$ mkdir folder
panzi@panzi tmp$ echo foo > folder/foo.txt
panzi@panzi tmp$ echo bar > folder/bar.txt
panzi@panzi tmp$ ~/src/python/u4pak/u4pak.py pack file.pak folder
panzi@panzi tmp$ ~/src/python/u4pak/u4pak.py list file.pak
folder/bar.txt
folder/foo.txt

from u4pak.

Nova77x avatar Nova77x commented on June 26, 2024

It seems to be a weird bug with argument parsing. This only happens when you omit "python", and just run the script directly. The arguments are read, but the first argument doesn't get parsed properly, even though it's in argv.

u4pak.py pack test.pak test

args:

Namespace(archive='test.pak', archive_version=3, check_integrity=False, command=Non
e, encoding='UTF-8', files=['test'], mount_point='..\..\..\', print0=Fa
lse, progress=False, verbose=False, zlib=False)

argv:

['pack', 'test.pak', 'test']

python u4pak.py pack test.pak test

args:

Namespace(archive='test.pak', archive_version=3, check_integrity=False, command='pa
ck', encoding='UTF-8', files=['test'], mount_point='..\..\..\', print0=
False, progress=False, verbose=False, zlib=False)

argv:

['pack', 'test.pak', 'test']

Go to the line "if args.command is None:", and just above it add "args.command = argv[0]". That fixes it.

from u4pak.

panzi avatar panzi commented on June 26, 2024

Btw. I've also written a new tool now that doesn't require Python, but instead I provide a compiled Windows binary. It is faster, but has slightly different command line arguments and a feature for Windows users that don't want to use a terminal. That means you can write a text file that contains what you otherwise would write as the command line arguments, change the extension from .txt to .u4pak and drop that file onto u4pak.exe (or you can also associate the .u4pak extension with u4pak.exe so that a double-click will automatically open it with that). This should also keep the window open after it is done (until you press ENTER). Though I haven't tested it under Windows since I'm on Linux.

from u4pak.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.