Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python code wont run and detects and invalid decimal literal on "60403" which is part of the code automatically upon starting a new project #126636

Closed
patrickdaneil opened this issue Nov 10, 2024 · 3 comments

Comments

@patrickdaneil
Copy link

patrickdaneil commented Nov 10, 2024

Bug report

Bug description:

detects "60403" as invalid decimal literal, Python 3.13.0 (tags/v3.13.0:60403a5, Oct 7 2024, 09:38:07) [MSC v.1941 64 bit (AMD64)] on win32 is already in the code when i start a new project

Full Code:

Python 3.13.0 (tags/v3.13.0:60403a5, Oct  7 2024, 09:38:07) [MSC v.1941 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> import serial
import time
import xpc 


 arduino_port = 'COM3'  # Change this to the correct port for your system
baud_rate = 9600
ser = serial.Serial(arduino_port, baud_rate)

host = "127.0.0.1"  # Localhost (X-Plane running on the same machine)
port = 49009  # Default X-Plane Connect port
xp = xpc.XPlaneConnect(host=host, port=port)


try:
     while True:
        if ser.in_waiting > 0:
          
             button_state = int(ser.readline().strip())

       
             print("Button state: ", button_state)

       
            xp.sendDREF("sim/flightmodel/controls/gear_handle", button_state)  # Example: control gear
 
             time.sleep(0.1)
 
 except KeyboardInterrupt:
     print("Exiting program.")
 finally:
     ser.close()
     xp.close()

CPython versions tested on:

3.13

Operating systems tested on:

Windows

@patrickdaneil patrickdaneil added the type-bug An unexpected behavior, bug, or error label Nov 10, 2024
@skirpichev
Copy link
Member

Could you please provide code example, which allows other to replicate your problem?

@skirpichev skirpichev added the pending The issue will be closed if no feedback is provided label Nov 10, 2024
@terryjreedy
Copy link
Member

Executing Python 3.13.0 (tags/v3.13.0:60403a5 gives that error. Don't do that. The whole line is printed when one opens either interactive Python (REPL) or IDLE Shell. Patrick, this is likely your error, perhaps from pasting this line + real code copied from either. If you think otherwise, please say exactly what you did, including what shell/editor/IDE you are using.

@picnixz
Copy link
Contributor

picnixz commented Nov 10, 2024

Confirming that the real code starts with bad code. You should only use:

import serial
import time
import xpc 

arduino_port = 'COM3'  # Change this to the correct port for your system
baud_rate = 9600
ser = serial.Serial(arduino_port, baud_rate)

host = "127.0.0.1"  # Localhost (X-Plane running on the same machine)
port = 49009  # Default X-Plane Connect port
xp = xpc.XPlaneConnect(host=host, port=port)

try:
    while True:
        if ser.in_waiting > 0:
            button_state = int(ser.readline().strip())
            print("Button state: ", button_state)
            xp.sendDREF("sim/flightmodel/controls/gear_handle", button_state)  # Example: control gear
            time.sleep(0.1)
except KeyboardInterrupt:
    print("Exiting program.")
finally:
    ser.close()
    xp.close()

and not the

Python 3.13.0 (tags/v3.13.0:60403a5, Oct  7 2024, 09:38:07) [MSC v.1941 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.

nor the >>> part. Closing as not an issue.

@picnixz picnixz closed this as not planned Won't fix, can't repro, duplicate, stale Nov 10, 2024
@picnixz picnixz removed type-bug An unexpected behavior, bug, or error pending The issue will be closed if no feedback is provided labels Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants