Passed AP6 and failed last challenge EJ5

I’m stuck on Stage #AP6

I changed my code to pass stage #AP6 and in the test logs it shows I passed but it failed me in last stage #EJ5. No clue what broke it

Here are my logs:

And here’s a snippet of my main function:

![image|607x500](upload://9M9WBHDChD0CVQ7T9Oyg4Yce4TJ.png)

def main():
    global file_directory
   
    if len(sys.argv) != 3 or sys.argv[1] != "--directory":
        print("Usage: ./your_server.sh --directory <directory_path>")
        return

    file_directory = sys.argv[2]
    
    server_socket = socket.create_server(("localhost", 4221))
    print("Server is running on port 4221...")

    try:
        while True:
            conn, addr = server_socket.accept()  # wait for client
            thread = threading.Thread(target=handle_client, args=(conn, addr))
            thread.start()
    except KeyboardInterrupt:
        print("Server is shutting down...")
    finally:
        server_socket.close()

The output clearly states that the connection wss refused.

I think this is where the problem is, not all stages will include the --directory flag, so you’ll need to treat this as optional.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.