subprocess.call() of 'sort' command within Django script is adding \M to the end of my files
It is highly unlikely that sort would on its own volition change line endings from Unix to Windows. It is more likely that A.csv already contains Windows line endings, and sort merely preserves them. If it is your script that's creating A.csv in the first place, double-check the newline convention that's being used.
I am messing around with Django.  I have a custom admin script in one of my apps (inside the management/commands folder) that has a subprocess.call() line.  I am doing a 'sort A.csv -o A_sorted.csv' call.  The sorted file that gets written is full of '^M' at the end of every line.  I find this doesn't happen when running the sort command from the command line or calling the same command through subprocess.call() from within a normal python script not running in Django.
Any ideas on why this is happening and what I can do to keep this from happening?
Thanks.