Fix conversion of pyargs to filename to not convert symlinks and not use deprecated features on Python 3.