#๐Ÿ”’ Tries to find line with the word "DEBUG" in it.

28 messages ยท Page 1 of 1 (latest)

runic zodiac
#

In this code, the line print("DEBUG !!!" is printed: https://pastebin.com/1xDfHa3N

But if I move the check 3 lines below, no print is done: https://pastebin.com/J9ZDucG2

It's weird as my other if "some word" in line: is working :/

wheat epochBOT
#

@runic zodiac

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.

runic zodiac
#

I've also tried have the DEBUG-check after the FAIL-check but it wont print anything there either.

glacial niche
#

i dont know why it wouldnt print, but im also not understanding the issue if it works the first way? can you explain why you want it lower in the order bc i dont see anything in my all of 10 seconds of looking at the code XD

runic zodiac
#

I want to create the debug.log inside the callID-folder, as in the logfile it could be 1000 callID's. If I create it above it would be a debug.log for all callIDs.

#

In the same way I do with FAIL-rows. ๐Ÿ™‚

glacial niche
#

and what is the need for lowering the debug statement if it works higher up? does it break other parts of code if its higher up?

#

im just trying to understand the issue bc im not sure what it is youre trying to ask, you showed it working and not working without much more explanation

runic zodiac
#

oh sorry. I try to store all debug-lines in a separate file named debug.log inside the callID-folder which I'm creating. I just feeling it weird that it wont work in the same way as for FAIL for example.

glacial niche
#

i can see that, is that working? or is that what youre needing help with?

runic zodiac
#

Also if I add a print(line above the os.chdir() line, it will print the debug-lines. But not if I place the print below.

#

The FAIL-part is working.

#

Above this line:
isExists = os.path.exists(f"{callID}")
if not isExists:
os.makedirs(f"{callID}")
os.chdir(f"{callID}")

It prints the lines including the DEBUG word. But if placed below it wont print them. I'm not getting it. ๐Ÿ˜ฎ

glacial niche
#

i dont know why it wouldnt either but if it works the one way why not just keep it that one way as long as it doesnt break anything else?

runic zodiac
#

Its breakes, as I want the file stored inside the folder created in the line above.

glacial niche
#

bc i dont see anything wrong with the it being below your is exists

glacial niche
#

bc thats all this statement contains, it shouldnt be able to mess anything up at all

runic zodiac
#

The print is just for debugging. When I get it working I will change to:

if "DEBUG" in line:
with open("DEBUG.log", "a") as output:
output.write(line)

#

But if's done before changing dir, it would be stored in the root and not inside the created callID-folder.

glacial niche
#

i have to go, but can you send a sample input for whoever tries to help you after me? not being able to run the code makes things a little difficult

runic zodiac
#

Sure, I'll fix that.

#

One INFO line, which works, and a DEBUG line which isn't if try print the line below os.chdir(f"{callID}")

#

Solved it. The index if callID was different in a DEBUG row then a INFO row. Weird as they look the same ๐Ÿ˜›

wheat epochBOT
#
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.

#

๐Ÿ”’ Tries to find line with the word "DEBUG" in it.