mindstorm38/portablemc

How do you run the game offline?

Closed this issue · 2 comments

the code is

from portablemc.standard import Version
Version().install().run()

the game is installed so is there anyway to run the game without using install()?
because when i run the code without internet while the game is installed it passes

Traceback (most recent call last):
  File "C:\Users\river\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 1348, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "C:\Users\river\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1282, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "C:\Users\river\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1328, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "C:\Users\river\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1277, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "C:\Users\river\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1037, in _send_output
    self.send(msg)
  File "C:\Users\river\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 975, in send
    self.connect()
  File "C:\Users\river\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1447, in connect
    super().connect()
  File "C:\Users\river\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 941, in connect
    self.sock = self._create_connection(
  File "C:\Users\river\AppData\Local\Programs\Python\Python310\lib\socket.py", line 824, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "C:\Users\river\AppData\Local\Programs\Python\Python310\lib\socket.py", line 955, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\river\PycharmProjects\portable_mc\install.py", line 2, in <module>
    Version().install().run()
  File "C:\Users\river\AppData\Local\Programs\Python\Python310\lib\site-packages\portablemc\standard.py", line 314, in install
    self._resolve_metadata(watcher)
  File "C:\Users\river\AppData\Local\Programs\Python\Python310\lib\site-packages\portablemc\standard.py", line 353, in _resolve_metadata
    if not self._load_version(handle, watcher):
  File "C:\Users\river\AppData\Local\Programs\Python\Python310\lib\site-packages\portablemc\standard.py", line 392, in _load_version
    version_super_meta = self.manifest.get_version(version.id)
  File "C:\Users\river\AppData\Local\Programs\Python\Python310\lib\site-packages\portablemc\standard.py", line 1472, in get_version
    for version_data in self._ensure_data()["versions"]:
  File "C:\Users\river\AppData\Local\Programs\Python\Python310\lib\site-packages\portablemc\standard.py", line 1424, in _ensure_data
    res = http_request("GET", VERSION_MANIFEST_URL, 
  File "C:\Users\river\AppData\Local\Programs\Python\Python310\lib\site-packages\portablemc\http.py", line 84, in http_request
    res: HTTPResponse = urllib.request.urlopen(req, context=ctx)
  File "C:\Users\river\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Users\river\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 519, in open
    response = self._open(req, data)
  File "C:\Users\river\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 536, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "C:\Users\river\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 496, in _call_chain
    result = func(*args)
  File "C:\Users\river\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 1391, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "C:\Users\river\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 1351, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 11001] getaddrinfo failed>

Hi! There must be a problem with the launcher's API, I'll look at this for the upcoming patch

Problem found! Should be fixed on next release.
Now, if any network error happens while fetching manifest, but the version is already installed, it will work.