IP1: code passes on local machine but doesn't pass test

I’m stuck on Stage IP1 using Python. When running commands from Path directories. my_exe may not be present on the cloud when using git and codecrafters.

I’ve viewed example codes but all of them did the same as I did.

Here are my logs:

remote: [tester::#IP1] > my_exe James
remote: [your-program] my_exe: command not found
remote: [your-program] $
remote: [tester::#IP1] Expected output to match "^Hello James! The secret code is 307778.\n", got "my_exe: command not found\r\n$ "
remote: [tester::#IP1] condition not met

And here’s a snippet of my code:

            try:
                subprocess.run(statement)
            except FileNotFoundError as err:
                print(command + ": command not found")

Both codecrafters and git push run tests remotely using the exact same infrastructure, that’s surprising. Can you confirm that you’re seeing failures when using Git push but the same works when using the codecrafters CLI? Or does this happen in both cases?

sorry my bad, I have edited the prompt above, but still I don’t see a problem except my_exe may not be on cloud or added to path

@Anvesh-2095 can you try adding some debug logs for this? Try printing out the contents of PATH, and all the contents of those directories?

More on this here: How do I debug test failures? - CodeCrafters

Hard to tell what’s going on without more info. We run the tester against bash in CI + multiple people have passed the stage so I don’t think it’s a case where my_exe isn’t present.

1 Like

Thanks, man for quick replies. I have got it fixed.
I just forgot that subprocess.run() takes string array of arguments so I needed to split. It worked fine on Windows but not on Linux.

1 Like

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