the-lodestone-project / Lodestone

Create Minecraft bots with a powerful, stable, and high level Python API.
https://lodestone-documentation.vercel.app/
MIT License
44 stars 2 forks source link

RuntimeError: threads can only be started once #40

Closed KavyanshKhaitan2 closed 7 months ago

KavyanshKhaitan2 commented 7 months ago

Describe the bug Offline/cracked server. I dont know what I am doing!

Code

import lodestone

bot = lodestone.createBot(
  host='Server IP',
  port=11310,
  auth='offline',
  username='Kavyansh_Bot',
)

To Reproduce

Steps to reproduce the behavior:

  1. Just download and install lodestone
  2. Copy the code from the previous section
  3. Install node.js
  4. Now execute that code

Expected behavior

I expected the bot to be in my minecraft server

Screenshots

If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context

Heres the terminal of the output:

Microsoft Windows [Version 10.0.19045.4170]
(c) Microsoft Corporation. All rights reserved.

C:\Users\User\Desktop\code\python\TheLodestoneBot>python main.py
--====--        --====--

Bridge failed to spawn JS process!

Do you have Node.js 16 or newer installed? Get it at https://nodejs.org/

--====--        --====--
Exception in thread Thread-2 (com_io):
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2288.0_x64__qbz5n2kfra8p0\Lib\threading.py", line 1045, in _bootstrap_inner   
    self.run()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2288.0_x64__qbz5n2kfra8p0\Lib\threading.py", line 982, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\javascript\connection.py", line 161, in com_io
    raise e
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\javascript\connection.py", line 149, in com_io
    proc = subprocess.Popen(
           ^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2288.0_x64__qbz5n2kfra8p0\Lib\subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2288.0_x64__qbz5n2kfra8p0\Lib\subprocess.py", line 1538, in _execute_child    
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified

** The Node process has crashed. Please restart the runtime to use JS APIs. **

Timed out get 0 needsNodePatches None
Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\lodestone\__init__.py", line 2, in <module>
    from lodestone.bot import createBot, Bot
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\lodestone\bot.py", line 1, in <module>
    from javascript import require, On, Once, off
--====--        --====--

Bridge failed to spawn JS process!

Do you have Node.js 16 or newer installed? Get it at https://nodejs.org/

--====--        --====--  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\javascript\__init__.py", line 20, in <module>
    init()
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\javascript\__init__.py", line 16, in init

    if config.global_jsi.needsNodePatches():
Exception in thread Thread-4 (com_io):
Traceback (most recent call last):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2288.0_x64__qbz5n2kfra8p0\Lib\threading.py", line 1045, in _bootstrap_inner   
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\javascript\proxy.py", line 230, in __getattr__
    self.run()
    methodType, val = self._exe.getProp(self._pffid, attr)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2288.0_x64__qbz5n2kfra8p0\Lib\threading.py", line 982, in run
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\javascript\proxy.py", line 150, in getProp
    self._target(*self._args, **self._kwargs)
    resp = self.ipc("get", ffid, method)
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\javascript\connection.py", line 161, in com_io
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\javascript\proxy.py", line 43, in ipc
    raise e
    raise Exception(f"Timed out accessing '{attr}'")
Exception: Timed out accessing 'needsNodePatches'

During handling of the above exception, another exception occurred:
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\javascript\connection.py", line 149, in com_io

Traceback (most recent call last):
    proc = subprocess.Popen(
  File "C:\Users\User\Desktop\code\python\TheLodestoneBot\main.py", line 1, in <module>
           ^^^^^^^^^^^^^^^^^
    import lodestone
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\lodestone\__init__.py", line 8, in <module>
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2288.0_x64__qbz5n2kfra8p0\Lib\subprocess.py", line 1026, in __init__
    from .bot import createBot, Bot
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\lodestone\bot.py", line 1, in <module>
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2288.0_x64__qbz5n2kfra8p0\Lib\subprocess.py", line 1538, in _execute_child    
    from javascript import require, On, Once, off
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\javascript\__init__.py", line 20, in <module>
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified
    init()
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\javascript\__init__.py", line 9, in init
    config.event_loop = events.EventLoop()
                        ^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\javascript\events.py", line 73, in __init__
    self.callbackExecutor.start()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2288.0_x64__qbz5n2kfra8p0\Lib\threading.py", line 959, in start
    raise RuntimeError("threads can only be started once")
RuntimeError: threads can only be started once

C:\Users\User\Desktop\code\python\TheLodestoneBot>
SilkePilon commented 7 months ago

Sorry for all the unnecessarily questions. The format is an template and I haven't had the time to update it.

SilkePilon commented 7 months ago

What is your node version?

Lodestone requires 18

SilkePilon commented 7 months ago

`Bridge failed to spawn JS process!

Do you have Node.js 16 or newer installed? Get it at https://nodejs.org/`

KavyanshKhaitan2 commented 7 months ago

Latest node.js. Just downloaded it after getting this error, and still getting it. Edit: If you say I havent restarted, i also updated my UEFI firmware after that so that required a reboot. Edit 2: image

Sorry for all the unnecessarily questions. The format is an template and I haven't had the time to update it.

I could help you do that!

KavyanshKhaitan2 commented 7 months ago

@SilkePilon please respond

KavyanshKhaitan2 commented 7 months ago

anyways... so... i restarted VSCode and that fixed the problem. for now i guess...

SilkePilon commented 7 months ago

mmmm strange