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

Really want to lean how to use this but.. #27

Open
Spikerama opened this issue Jul 11, 2019 · 28 comments
Open

Really want to lean how to use this but.. #27

Spikerama opened this issue Jul 11, 2019 · 28 comments

Comments

@Spikerama
Copy link

When I try to run the script in CMD it says your PC cant run this.

I have the latest version of Python installed. 3.7.4

@panzi
Copy link
Owner

panzi commented Jul 11, 2019

What is the exact message? What is the exact way you try to run this? What operating system do you use? Did you explicitly run it through Python?

@Spikerama
Copy link
Author

Wow, thanks so much for your fast reply. No I didn't run it in python. I did it in CMD.

The file I want to unpack is a .pak with this name ProjectYUKI-WindowsNoEditor.pak.
It sits in a HD separate to my main C:\ HD. The path is E:\Games\FOCUS_on_YOU\steamapps\common\FOCUS on YOU\ProjectYUKI\Content\Paks\ProjectYUKI-WindowsNoEditor.pak

My main Drive with Windows 10 on it user is called Norvid

The script isn't doing what it was doing yesterday anymore. Seems to happily sit in the CMD prompt but the argument comes back and incorrect syntax.

I tried to retro-fit the string you gave as help to a previous poster by changing the relevant details to my PC but it didn't work.

Would love an explanation as I'm terrible with this kind of thing but love learning and appreciate all the efforts of people who are happy to share their works with the community.

@panzi
Copy link
Owner

panzi commented Jul 12, 2019

Try something like this:

"C:\path\to\python.exe" "C:\path\to\u4pak.py" unpack --verbose "E:\Games\FOCUS_on_YOU\steamapps\common\FOCUS on YOU\ProjectYUKI\Content\Paks\ProjectYUKI-WindowsNoEditor.pak"

I just saw: you have spaces in the file path. You need to quote file path that have spaces in them (i.e. put " around them) to make clear that is meant as a single argument and not like in this case 3 separate arguments. (This is nothing specific to this script, but a general thing on how to pass arguments to a program.)

You could also create a file u4unpack.bat and put this into it (of course fix the path to where the files actually are on your system) and then just drop the .pak file onto the .bat file:

@echo off
"C:\path\to\python.exe" "C:\path\to\u4pak.py" unpack %1
set /p temp="Hit enter to continue"

Make sure it really has a .bat extension (you need to disable hiding of file extensions).

Since I don't use Windows I haven't tested this myself. Don't know if there is a bug in this batch script, it's written from head.

I hope that helps! :)

@Spikerama
Copy link
Author

Cool that sounds easier. So do I just create a text file and then save the code as a .bat?

@Spikerama
Copy link
Author

Thanks for that. Tried it and after dragging the files on to it the CDM window came up and said hit Enter. So I did and nothing happened. Didn't notice a blip on any cpu usage.

This is how I put it in the the text doc and then save as a bat.

@echo off
"C:\Users\Norvid\Desktop\New folder (2)\python.exe" "C:\Users\Norvid\Desktop\New folder (2)\u4pak-master\u4pak.py" unpack %1
set /p temp="Hit enter to continue"

Does the space between New and folder have anything to do with it?

@panzi
Copy link
Owner

panzi commented Jul 12, 2019

Is there no message before "Hit enter to continue"?
(The message probably should've been "Hit enter to exit". It's just so the window doesn't immediately close itself after the script did run.)

If there really is no message add --verbose after unpack and try again.

@Spikerama
Copy link
Author

This is what it looks like before enter. After enter it disappears.
SharedScreenshot

@panzi
Copy link
Owner

panzi commented Jul 13, 2019

Hm, it somehow can't find or execute python. I don't know much about Windows or how command quoting works there. Try to put python into a path that has no spaces in it (e.g. rename the folder to New_folder_2) and then remove the quotes around path of the python executable:

@echo off
C:\Users\Norvid\Desktop\New_folder_2\python.exe C:\Users\Norvid\Desktop\New_folder_2\u4pak-master\u4pak.py unpack %1
set /p temp="Hit enter to continue"

Spaces in filenames are always making problems, because it wasn't really thought through how these things work. If you can have spaces in filenames, when you pass the filename to a program, how does it know its one argument with a space in it or two arguments? That's what the quotes are for, but maybe it works differently than I thought under Windows. Under Linux/macOS there is a clear way to handle spaces, but even there it still can lead to problems.

@panzi
Copy link
Owner

panzi commented Jul 13, 2019

PS: I don't know what the current working directory of a batch file executed that way is. The extracted files will be placed into that directory. It might be the directory the batch file is in, or it might be your user home directory (C:\Users\Norvid).

@Spikerama
Copy link
Author

Hey thanks so much for sticking with me on this. It's a bit of a puzzle but I think you are like me and like to solve them.

I did discover something based on your last suggestion. The python.exe in folder 2 is the bloody application install exe lol. So I looked in Users\Norvid and found he actual python.exe. But....!! When I modded the bat and dragged the target on it came up with that message again.

"This app cant run on your PC."

AppCantRun

One thing I noticed is that the python version is 32bit and I'm running 64. Could that have anything to do with it? I didnt notice a 64bit version when I was getting it.

@panzi
Copy link
Owner

panzi commented Jul 13, 2019

I don't know how Windows manages 32bit applications on 64bit installations. I thought 32bit applications where supported on 64bit Windows. But yes, it could be the problem. Google says you can install Python via the Microsoft Store. I have no experience with that, but I guess that would be worth looking into?

@Spikerama
Copy link
Author

Cheers mate I'll give it a go and report back.

@Spikerama
Copy link
Author

Hi again,

So I managed to prevent that error by installing a 64bit version of python. However nowiit seems the script cant open it. Not sure if it's because the syntax is wrong with the python being in \Program Files\ Note the sp ace. It did put quotes around the two args as bellow but got the attached message back.

@echo off
"C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1264.0_x64__qbz5n2kfra8p0\python.exe" "C:\Users\Norvid\Desktop\New_folder_2\u4pak-master\u4pak.py unpack %1
set /p temp="Hit enter to continue"

Python64biterror

I've done the code wrong haven't I? Or should I move python to a folder with no spaces?

@panzi
Copy link
Owner

panzi commented Jul 17, 2019

You have a wrong quote. It needs to be:

@echo off
"C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1264.0_x64__qbz5n2kfra8p0\python.exe" C:\Users\Norvid\Desktop\New_folder_2\u4pak-master\u4pak.py unpack %1
set /p temp="Hit enter to continue"

@Spikerama
Copy link
Author

I think I had that originally. Let me try it again.

@Spikerama
Copy link
Author

Same thing unfortunately.

C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1264.0_x64__qbz5n2kfra8p0\python.exe: can't open file 'C:\Users\Norvid\Desktop\New_folder_2\u4pak-master\u4pak.py': [Errno 2] No such file or directory
Hit enter to continue

@panzi
Copy link
Owner

panzi commented Jul 17, 2019

Well, that sounds like that file does not exist. Where did you put u4pak.py?

@Spikerama
Copy link
Author

It's in New_Folder_(2)

NewFolder2jpg

@panzi
Copy link
Owner

panzi commented Jul 17, 2019

Well then you need to write:

@echo off
"C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1264.0_x64__qbz5n2kfra8p0\python.exe" C:\Users\Norvid\Desktop\New_folder_(2)\u4pak-master\u4pak.py unpack %1
set /p temp="Hit enter to continue"

@Spikerama
Copy link
Author

Bloody hell, of course.

@Spikerama
Copy link
Author

unsupported version: 5
Hit enter to continue

Hmmn..
Could that be to do with the .pak itself? As in encrypted? Or is it to do with the python build?

@panzi
Copy link
Owner

panzi commented Jul 17, 2019

That means it's a file format version I don't know about and therefore can't read. Sorry.
It might very well be that there is not at all much difference between version 4 (the latest supported) and 5, but I don't know. I don't have access to a file of version 5. Someone who knows a bit of Python and has access to the appropriate file could try around and maybe get it to work. Maybe read it like a file of version 4, but read more and more bytes as the file header until it won't crash anymore or unpacks files that aren't corrupted.

After all that hassle that's disappointing, sorry. :/

@Spikerama
Copy link
Author

Not at all mate. I really appreciate you taking all that time to have a go and try to help me.

It interesting too so I kind of enjoy tinkering with a very large amount of guidance from you.

@Spikerama
Copy link
Author

Well if you want to play with it just for fun I could easily create a megaupload if you have the bandwidth.

@panzi
Copy link
Owner

panzi commented Jul 17, 2019

No. No copyright infringement.

@Spikerama
Copy link
Author

Fair point. Thanks again mate for helping.

:)

@pyromaniac420710
Copy link

I used this issue to figure out what to do and your python script works perfectly :)

@panzi
Copy link
Owner

panzi commented May 14, 2021

(Reading through old issues right now.)
Have you tried to use this script with --force-version=3 or with --force-version=7? Because I have seen paks of version 3 and 7 and can handle them now, but there is a change in things somewhere between these two versions and I don't know where. So one of the two will probably work. Would be interesting to me which one, or if none of them works.

Also: 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. Does that work for you?

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

3 participants