I don't know if this is a problem with python or with the shell (zsh on linux), I've an argument like this: "@xyz" that starts with a "@"

python first_argument @second_argument third_arg

I tried to escape @ with \ or \\, or use "" but the program doesn't start. If I leave the @ from @second_arguments everything's ok.

Was it helpful?


  1. Perhaps the "@" is a glob character in zsh, expanding to all symbolic links in the current directory. Try escaping it with "@@"?

  2. Try running the argument list with echo, i.e:

    echo first_argument @second_argument third_arg

That way, you can figure out if it was expanded or passed as-is to the script.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow