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

Havein trouble installing a version #220

Open
AinRyzen opened this issue May 20, 2024 · 11 comments
Open

Havein trouble installing a version #220

AinRyzen opened this issue May 20, 2024 · 11 comments
Assignees
Labels
api This issue is related to the API or its implementation bug Something isn't working

Comments

@AinRyzen
Copy link

AinRyzen commented May 20, 2024

So to put this in context, I build a GUI app around your module with tkinter or customtkinter, so I have to run the launch process in a thread and I think that's what make this issue I noticed that the version would work after I rebooted my application however here is the error

  File "C:\Users\benno\AppData\Local\Programs\Python\Python312\Lib\site-packages\portablemc\standard.py", line 326, in install
    self._download(watcher)
  File "C:\Users\benno\AppData\Local\Programs\Python\Python312\Lib\site-packages\portablemc\standard.py", line 967, in _download
    for result_count, result in self._dl.download(threads_count, partial_progress=True):
  File "C:\Users\benno\AppData\Local\Programs\Python\Python312\Lib\site-packages\portablemc\download.py", line 213, in download
    raise ValueError(f"unexpected crash from thread {crash.thread_id}", crash.origin)
ValueError: ('unexpected crash from thread 30', PermissionError(13, 'Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird')) 
@mindstorm38
Copy link
Owner

Are you sure that the installation is run only once at a time? It looks like the same file is downloaded twice at the same time

@AinRyzen
Copy link
Author

AinRyzen commented May 21, 2024

Are you sure that the installation is run only once at a time? It looks like the same file is downloaded twice at the same time

i am defining a Context and a Version than i install it and After that i am running the Version all in a thread when i am home will send you a replica of this situation

@mindstorm38
Copy link
Owner

Your report is interesting tho., because it may be an issue with PMC, where the same file is downloaded twice at the same time by different downloading threads.

@AinRyzen
Copy link
Author

AinRyzen commented May 22, 2024

Your report is interesting tho., because it may be an issue with PMC, where the same file is downloaded twice at the same time by different downloading threads.

Here is my example

import customtkinter as ctk
import threading
import portablemc.standard
import pathlib
def launch():
    def threadlaunch():   context=portablemc.standard.Context(main_dir=pathlib.Path("maintesting"),work_dir=pathlib.Path("maintesting"))
        print("Defining the version")
        version = portablemc.standard.Version(version="1.16.5",context=context)
        print("installing")
        env = version.install()
        print("Running") 
        env.run()
    threading.Thread(target=threadlaunch,daemon=True).start()                       
window = ctk.CTk()
startbutton = ctk.CTkButton(window,text="Start",command=launch)
startbutton.pack(pady=10,padx=10,fill="both")
window.mainloop()

Apparently, this dose only happen when the script is run in a thread

@AinRyzen
Copy link
Author

Never mind, I just got this error without using threading

@mindstorm38
Copy link
Owner

Ok, this is definitely interesting, would you be ok to take time to test a specific dev branch later on?

@mindstorm38
Copy link
Owner

Also, from you "print" calls, are you sure that only one threadlaunch is called at a time? (threaded or not, I don't know if the callback given to CTkButton is launched in a thread.

@AinRyzen
Copy link
Author

AinRyzen commented May 28, 2024

Also, from you "print" calls, are you sure that only one threadlaunch is called at a time? (threaded or not, I don't know if the callback given to CTkButton is launched in a thread.

Yes i am sure that it's downloading only once i think its a specific file or folder that is a problem you might saw that the main directory and working directory are the same maybe there are two folder or file who have the same name if you know what i mean but that doesn't explain why working without the thread it's definitely installing a few folder and files and only than give me the error

@mindstorm38
Copy link
Owner

I'll be working on a new patch version soon, I'll try to fix the issue at the same time.

@mindstorm38 mindstorm38 self-assigned this Jun 14, 2024
@mindstorm38 mindstorm38 added bug Something isn't working api This issue is related to the API or its implementation labels Jun 14, 2024
@mindstorm38
Copy link
Owner

mindstorm38 commented Jun 15, 2024

I've found the issue, I think.
For example, in the asset index 17 there are two identical assets 6ea4e448fbc2a079acb0cf3564273083dadae165: minecraft/sounds/entity/fish/swim1.ogg and minecraft/sounds/liquid/swim1.ogg. I didn't know this was possible, so I'll just download once.

@AinRyzen
Copy link
Author

Nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api This issue is related to the API or its implementation bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants