Welcome!
This is probably all about line-endings. Lines can end with CR and LF, or just LF, and sometimes these get automatically added when you didn't expect that.
Can you post the few relevant lines of code from your program?
Or even better, post a very short stand-alone script that demonstrates the problem?
This is the fastest and most reliable way to get help here on the forum.