Help me create a script /u/Charrleyy Python Education

So I don’t really post on reddit much but I have been having an issue recently so I reach out for your help.

I have a EXE file that opens a test console for a USB Controller. This USB controller does not work directly with windows regardless of what drivers I install so I have given up on that so far. Navigating the test console I am able to achieve a live log of the position data of where the axis’s of the usb controller is. What I need is to be able to take that position data given in the console and send it to a virtual joystick (vjoy) where Windows will be able to use that as a game controller.

What Ive tried.
Im not good at all with python and admit to using a lot of chat gpt to help me write this code. I know chat gpt can be wrong in so many ways but it was really the only thing that I got as ive researched this exact issue online and havent found much. I have tried using the subprocess.popen utility with python but what ive found is that the exe bypasses stdout and writes directly to the console.

import subprocess import time try: # Start the EXE and capture its output process = subprocess.Popen( ['D:\Charlie\Documents\C2ProTestCon.exe'], # Path to your EXE stdout=subprocess.PIPE, # Capture standard output stderr=subprocess.STDOUT, # Merge stderr with stdout stdin=subprocess.PIPE, # Enable sending commands text=True, # Ensure text mode bufsize=0, # Unbuffered output universal_newlines=True ) time.sleep(0.5) print("==== Program Output Start ====") # Print output line by line while True: output = process.stdout.readline() # Read one line from stdout if output == '' and process.poll() is not None: # Process has ended break if output: # Print non-empty lines print(output.strip()) except FileNotFoundError as e: print(f"Error: The file was not found. Check the path.nDetails: {e}") except Exception as e: print(f"Error: {e}") finally: print("==== Program Outputg End ====") 

I don’t really know what to do from here on out. The EXE is pretty old (2011). If you do not know the exact solution but could at least point me in a direction that could lead to a solution I would greatly appreciate your help. If anyone would like a video of the consoles output or even the exact exe file let me know and I will provide all I can.

submitted by /u/Charrleyy
[link] [comments]

​r/learnpython So I don’t really post on reddit much but I have been having an issue recently so I reach out for your help. I have a EXE file that opens a test console for a USB Controller. This USB controller does not work directly with windows regardless of what drivers I install so I have given up on that so far. Navigating the test console I am able to achieve a live log of the position data of where the axis’s of the usb controller is. What I need is to be able to take that position data given in the console and send it to a virtual joystick (vjoy) where Windows will be able to use that as a game controller. What Ive tried. Im not good at all with python and admit to using a lot of chat gpt to help me write this code. I know chat gpt can be wrong in so many ways but it was really the only thing that I got as ive researched this exact issue online and havent found much. I have tried using the subprocess.popen utility with python but what ive found is that the exe bypasses stdout and writes directly to the console. import subprocess import time try: # Start the EXE and capture its output process = subprocess.Popen( [‘D:\Charlie\Documents\C2ProTestCon.exe’], # Path to your EXE stdout=subprocess.PIPE, # Capture standard output stderr=subprocess.STDOUT, # Merge stderr with stdout stdin=subprocess.PIPE, # Enable sending commands text=True, # Ensure text mode bufsize=0, # Unbuffered output universal_newlines=True ) time.sleep(0.5) print(“==== Program Output Start ====”) # Print output line by line while True: output = process.stdout.readline() # Read one line from stdout if output == ” and process.poll() is not None: # Process has ended break if output: # Print non-empty lines print(output.strip()) except FileNotFoundError as e: print(f”Error: The file was not found. Check the path.nDetails: {e}”) except Exception as e: print(f”Error: {e}”) finally: print(“==== Program Outputg End ====”) I don’t really know what to do from here on out. The EXE is pretty old (2011). If you do not know the exact solution but could at least point me in a direction that could lead to a solution I would greatly appreciate your help. If anyone would like a video of the consoles output or even the exact exe file let me know and I will provide all I can. submitted by /u/Charrleyy [link] [comments] 

So I don’t really post on reddit much but I have been having an issue recently so I reach out for your help.

I have a EXE file that opens a test console for a USB Controller. This USB controller does not work directly with windows regardless of what drivers I install so I have given up on that so far. Navigating the test console I am able to achieve a live log of the position data of where the axis’s of the usb controller is. What I need is to be able to take that position data given in the console and send it to a virtual joystick (vjoy) where Windows will be able to use that as a game controller.

What Ive tried.
Im not good at all with python and admit to using a lot of chat gpt to help me write this code. I know chat gpt can be wrong in so many ways but it was really the only thing that I got as ive researched this exact issue online and havent found much. I have tried using the subprocess.popen utility with python but what ive found is that the exe bypasses stdout and writes directly to the console.

import subprocess import time try: # Start the EXE and capture its output process = subprocess.Popen( ['D:\Charlie\Documents\C2ProTestCon.exe'], # Path to your EXE stdout=subprocess.PIPE, # Capture standard output stderr=subprocess.STDOUT, # Merge stderr with stdout stdin=subprocess.PIPE, # Enable sending commands text=True, # Ensure text mode bufsize=0, # Unbuffered output universal_newlines=True ) time.sleep(0.5) print("==== Program Output Start ====") # Print output line by line while True: output = process.stdout.readline() # Read one line from stdout if output == '' and process.poll() is not None: # Process has ended break if output: # Print non-empty lines print(output.strip()) except FileNotFoundError as e: print(f"Error: The file was not found. Check the path.nDetails: {e}") except Exception as e: print(f"Error: {e}") finally: print("==== Program Outputg End ====") 

I don’t really know what to do from here on out. The EXE is pretty old (2011). If you do not know the exact solution but could at least point me in a direction that could lead to a solution I would greatly appreciate your help. If anyone would like a video of the consoles output or even the exact exe file let me know and I will provide all I can.

submitted by /u/Charrleyy
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *