#๐Ÿ”’ Problem with I am not sure what

44 messages ยท Page 1 of 1 (latest)

stoic hemlock
#

So i copied brnach from github in which my friend added scores that saves online.
But instead of working when I start it shows nothing for about 2 minutes and then it shows these mistakes. On my friend's computer it works and I am not sure what could be a problem. Both of us are on beginner level so it is possible we just don't know about something simple.

If someone would help it would be great

strong parrotBOT
#

@stoic hemlock

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

tight sedge
#

what the HELL

#

how??

stoic hemlock
#

I had to change the image

stoic hemlock
tight sedge
#

can you share us the code

#

@stoic hemlock

quartz yacht
#

Could be 3.13 being stricter on tls

stoic hemlock
#
from NumberMemory import *
from ReactionTime import *
from Scoreboard import *

import os
import shutil
import keyboard
import time

RESET = "\033[0m"
GREEN = "\033[92m"
WHITE = "\033[97m"

mongodb_uri = "somethuing" (it was different ,just in case)
db_name = "game_scores"
collection_name = "scores"

scoreboard = Scoreboard(mongodb_uri, db_name, collection_name)
scoreboard.fillScores()

def display_menu(options, selected_index):
    os.system('cls' if os.name == 'nt' else 'clear')
    terminal_width = shutil.get_terminal_size().columns 
    
    for index, option in enumerate(options):
        text = f"> {option}" if index == selected_index else f"  {option}"
        color = GREEN if index == selected_index else WHITE


        centered_text = text.center(terminal_width)
        print(f"{color}{centered_text}{RESET}")

def main():
    options = ["Reaction Time", "Number Memory", "Scores"]
    selected_index = 0
    display_menu(options, selected_index)

...(To long message)

#
    while True:
        event = keyboard.read_event()
        
        if event.event_type == "down":
            if event.name == "down":
                selected_index = (selected_index + 1) % len(options)
                display_menu(options, selected_index)

            elif event.name == "up":
                selected_index = (selected_index - 1) % len(options)
                display_menu(options, selected_index)

            elif event.name == "enter":
                clear = lambda: os.system('cls' if os.name == 'nt' else 'clear')
                clear()
                
                if selected_index == 0:
                    game = ReactionTime()
                    game.play()

                elif selected_index == 1:
                    game = NumberMemory()
                    game.play()
                    scoreboard.saveScore(game.nickname,"Number memory",game.score)
                
                elif selected_index == 2:
                    scoreboard.printScores()
                    time.sleep(4)
                break

if __name__ == "__main__":
    main()
quartz yacht
#

Use the paste tool if it's too long

#

!paste

strong parrotBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

quartz yacht
stoic hemlock
#

!paste

strong parrotBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

quartz yacht
#

Can you show the git diff for the code that broke it?

stoic hemlock
#

How can I show it?

quartz yacht
#

Paste it in as text?

#

Or do you mean how to see it on your terminal?

#

It's git show <the commit that broke it>

stoic hemlock
#

I was supposed to install it like this:
"python -m pip install "pymongo[srv]"==3.13"

quartz yacht
#

pymongo 3 is very old

quartz yacht
#

It's better to maintain a requirements.in and requirements.txt for projects like this - rather than share install commands by word of mouth

#

This doesn't look like a git diff - and you leaked your password. You'll need to change it asap

stoic hemlock
quartz yacht
stoic hemlock
#

o shit

#

thanks

quartz yacht
#

It should not be committed to git, you should read it from a secrets manager or from an environment variable

#

Try with the latest version of pymongo instead

stoic hemlock
#

okay

#

i will try
Thank you

quartz yacht
stoic hemlock
#

I will remember
thanks

strong parrotBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.