Minecraft-Console-Client icon indicating copy to clipboard operation
Minecraft-Console-Client copied to clipboard

Help with an error while running custom script

Open JayDeeper opened this issue 3 years ago • 9 comments

Hey basically a mate and me wrote a script in python for a server and it was working all fine no errors of bugs and we stopped playing for a while but i started playing again and everytime i try and run the script i get this error

Unhandled Exception: System.InvalidOperationException: Cannot see if a key has been pressed when either application does not have a console or when console input has been redirected from a file. Try Console.In.Peek.

at System.Console.get_KeyAvailable()

at MinecraftClient.Program.HandleFailure(String errorMessage, Boolean versionError, Nullable`1 disconnectReason)

at MinecraftClient.Program.InitializeClient()

at MinecraftClient.Program.Main(String[] args)

when i launch mcc normally it works if someone wants to help out i can send them the code also i should point out the script works on my friends pc but not mine

JayDeeper avatar Jul 31 '22 09:07 JayDeeper

Are you running the latest exe release or did you build from source?

breadbyte avatar Jul 31 '22 10:07 breadbyte

Are you running the latest exe release or did you build from source?

latest exe, we are both using same python version and same mcc version

JayDeeper avatar Jul 31 '22 10:07 JayDeeper

Are you running the latest exe release or did you build from source?

hey just wondering if your still up for helping me

JayDeeper avatar Aug 05 '22 02:08 JayDeeper

Sure! I was just out of town for a bit so I was unavailable for a while.

I'll get to your request in a bit. Can I get a copy of your script?

breadbyte avatar Aug 05 '22 15:08 breadbyte

Sure! I was just out of town for a bit so I was unavailable for a while.

I'll get to your request in a bit. Can I get a copy of your script?

nw i really apreciate it here is a pastebin link https://pastebin.com/m83B2dnN all it is is basically a chat reader so i get alerts for certain things should be easy enough to understand it

JayDeeper avatar Aug 05 '22 15:08 JayDeeper

I can't seem to replicate this issue, are you using any specific console other than the windows command prompt? What are the steps you usually do when you run this code?

breadbyte avatar Aug 10 '22 01:08 breadbyte

I can't seem to replicate this issue, are you using any specific console other than the windows command prompt? What are the steps you usually do when you run this code?

No i normally run it through command prompt or idle if im testing something new, my mate of mine cant replicate it either we were thinking its something to do with a .net framework but ive reinstalled most. This is what my friend said "The error is caused by the Popen Because we're redirecting the stdin to PIPE But there shouldn't be an error in the first place"

JayDeeper avatar Aug 10 '22 01:08 JayDeeper

like i said before the script ran fine about 8 months ago and now just wont work

JayDeeper avatar Aug 10 '22 01:08 JayDeeper

You can try a different terminal like Windows Terminal or Alacritty and see if it makes a difference.

Your friend is correct in the fact that there really shouldn't be an error here in the first place which is getting me confused.

breadbyte avatar Aug 10 '22 02:08 breadbyte