0

im trying to make a python script that lets me input commands into the minecraft server. I'm having issues with multiple commands enter image description here

I want it to run "say test" "list" "save-all" separately but instead, it just runs "say testlistsave-all"

2
  • 1
    Looks like the program does not know where your individual commands end. How about adding a space or a newline (\n) at the end of each command string. Commented Feb 21, 2021 at 18:06
  • adding a space didnt work but a newline fixed it! Thanks, also i already tried \n but i used /n instead so thats why it didnt work Commented Feb 21, 2021 at 18:31

1 Answer 1

0

You never write the ENTER key.

Do do that, you have to write a newline char \n at the end of each command. (Source)

So, you will have something like that:

MCser.stdin.write(b'say test\n')
MCser.stdin.write(b'list\n')
MCser.stdin.write(b'save-all\n')

You can something like that to run command easier:

def runcmd(mycmd):
   MCser.stdin.write(mycmd)
   MCser.stdin.write(b'\n')

runcmd(b'say test')
runcmd(b'list')
runcmd(b'save-all')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.