JohnSundell / SwiftPlate

Easily generate cross platform Swift framework projects from the command line
MIT License
1.77k stars 88 forks source link

Fix for python syntax error in testStructure.py #21

Closed idcrook closed 7 years ago

idcrook commented 7 years ago

Platform: macOS 10.12, Python 2.7.12

Error example

$ python ../SwiftPlate/testStructure.py test

File "testStructure.py", line 30
SyntaxError: Non-ASCII character '\xe2' in file testStructure.py on line 30, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
codeOfRobin commented 7 years ago

@Uh, it's built in python3 @idcrook . And the invalid characters are ⭐️ emojis 😅

idcrook commented 7 years ago

after putting the encoding declaration in the file (which is what this PR does), it successfully ran on my system (on Python 2.7.12)

# -*- coding: utf-8 -*-

Are you saying this PR should be rejected?

codeOfRobin commented 7 years ago

No, no. I just realised why it happened. Python 3 assumes UTF-8 encoding.

I have a tiny doubt though. Doesn't Python 2 have a different print syntax? I'd suggest you test it out by running swiftplate once (pass in whatever params you like), then run testStructure.py {{project_name_you_chose_previously}}, and see if it works.

Just tested, it worked!

JohnSundell commented 7 years ago

Great, so now we can run the tests on systems with both Python 2 and 3 🎉 Thanks for this @idcrook!