Update-lines.py returns !=0

I have problems with update-lines.py script, the exception is in the script take-subscription-snapshot.sh then I thougth that I could solve that executing the script in my virtual machine of kali but the problem continues. I am working in Windows 10 and the console output is:

Traceback (most recent call last):
File “…/…/tools/update-lines.py”, line 118, in
main()
File “…/…/tools/update-lines.py”, line 100, in main
command("…/…/tools/take-subscription-snapshot.sh > toe/snapshot")
File “…/…/tools/update-lines.py”, line 29, in command
raise Exception(f"CRITICAL: {cmd} return a non-zero status code.")
Exception: CRITICAL: ../../tools/take-subscription-snapshot.sh > toe/snapshot return a non-zero status code.

@trusting-murdock any idea? any clues that could help @hollow-knight. thanks in advance

Did you share the output from your Linux VM or from your Windows OS?

In case it’s the Windows output, can you please also share the output from Linux?

It’s my linux output when I wrote the post. But now I shared the continuous folder with my VM, next I used dos2unix command in tools folder and then I ran update-lines.py. The script takes long and when it finish the file lines.csv is empty.

I don’t think you’d have to use dos2unix if you’re already running the script in a VM. Please checkout lines.csv with the last version from master and run the script again from your VM. Let me know if you get a different error.

You can checkout the file with the following command:

git checkout -- lines.csv

I ran update-lines.py without dos2linux over last version of lines.csv and this is the linux output.

/usr/bin/env: ‘bash\r’: No such file or directory
Traceback (most recent call last):
File “…/…/tools/update-lines.py”, line 117, in
main()
File “…/…/tools/update-lines.py”, line 100, in main
command("…/…/tools/take-subscription-snapshot.sh > toe/snapshot")
File “…/…/tools/update-lines.py”, line 29, in command
raise Exception(f"CRITICAL: {cmd} return a non-zero status code.")
Exception: CRITICAL: ../../tools/take-subscription-snapshot.sh > toe/snapshot return a non-zero status code.

I’m pretty sure the issue has to do with this specific line:

/usr/bin/env: ‘bash\r’: No such file or directory

It’s interesting how the “\r” is included at the end of the line.

Are you sharing the repo to your VM after cloning it from Windows? If that is the case, can you please take the time to clone the repo directly from your VM and then run the script from there?

EDIT: Check this post https://stackoverflow.com/questions/29045140/env-bash-r-no-such-file-or-directory

1 Like

I will try to clone the repo directly my VM and then run the script from there but I just don’t think this is a solution because If I want to work in Windows simply I can’t, Do I have work in linux?

I would like to add that this problem not only applies to this particular script,
but to many others we need to use everyday.
It is not uncommon to see things such as:

  • forward slashes, where os.sep can be used,
  • subprocess calls to the git command, when v.g. gitpython can be used,
  • system calls to linux commands that will fail in windows, etc.

Given that many of us need or prefer to use Windows,
it would be nice if the python tools used to enable the testing process
were as OS-agnostic as possible,
so that they become not an obstacle but what they are meant to be: helpers.

1 Like

Good reflections, and my recommendation again, is to use and base everything in NixOS, Nix, and every possible derivative, is the only thing that have the potential to give Unix and Linux the best potential for agnosticity:

@hollow-knight If this topic is solved, please mark it as such by checking the solution chart at the bottom of the post you consider that properly answers your question. If not, please update the post with fuhrer information about the issue and/or the proposed solutions of the participants.

After trying a lot of things, the script never worked in windows then I had to download and install WSL(Windows Subsystem for Linux).

1 Like