2

I forked https://github.com/feross/SpoofMAC to https://github.com/pteek/SpoofMAC.

If I change line 14 from

execfile('spoofmac/version.py', {}, local_results)

to

exec(compile(open('spoofmac/version.py').read(), 'spoofmac/version.py', 'exec'), {}, local_results)

(Needed to make it work on python 3.x)

The changed setup.py does not execute. the error given is:

C:\Python soft\SpoofMAC-master>setup.py install
  File "C:\Python soft\SpoofMAC-master\setup.py", line 3
    env python
             ^
SyntaxError: invalid syntax

If I make the same change manually on my PC, the file works.

the file from github AFTER CHANGE is 906 bytes. The file on PC AFTER CHANGE is 941 bytes.

It seems like there is some encoding problem. How do I fix it?

pteek
  • 43
  • 4
  • I don't understand. You modify the file on github? Or did you clone your repo and change it there? If it's the first case, forget about it. Clone the repo, change your file, see that it works (it should as you already pointed out), commit and push. – nietonfir Apr 13 '14 at 17:05
  • I use the github website. I don't have a github client on PC. Should I use the windows client? – pteek Apr 13 '14 at 17:32
  • Neither. Use git as it's [supposed to be used](https://help.github.com/articles/set-up-git). Clone your repo, modify the file, commit and push. – nietonfir Apr 13 '14 at 19:04

2 Answers2

0

Maybe a tab-spaces config? Some git clients have configurations settings related to automatic indentation fixes that can affect your file after you modify it.

technik
  • 39
  • 4
0

Make sure you don't have set to true:

git config core.autocrl

If it is set to true, it would convert the eol (end of line) characters automatically (from CR to CRLF).

Try:

git config --global core.autocrlf false

Then clone again (or reset your current index) and try again your change.

See "git replacing LF with CRLF" for more on that core.autocrlf setting.
I have always preferred set it to false.


In this case, that was the reverse issue:

the code is converted back to unix-style eol when pushed to GitHub.
Can you try on your file a dos2unix (or any Notepad++/SublimeText editor, able to show you / convert for you your eol style), and make sure you are using the unix style (and see if that is working then)

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I did this. Still the same error. I deleted the repo from github website. Then forked it again. Cloned it to my PC github(I use their latest windows client). I ran all the LOCAL files through 2to3.py. This produces a setup.py file of 941 bytes. This file executes perfectly. Then I synced these changes to github. Still same problem. The file there is 901 bytes and does not execute. I ran your command git config --global core.autocrlf false before doing all this. – pteek Apr 13 '14 at 17:54
  • @pteek maybe this is the reverse problem, and the code is converted back to unix-style eol when pushed to GitHub. Can you try on your file a dos2unix (http://dos2unix.sourceforge.net/) (or any Notepad++/SublimeText editor, able to show you / convert for you your eol style), and make sure you are using the unix style (and see if that is working then) – VonC Apr 13 '14 at 19:27
  • This seems to be the issue. GREAT WORK! The author has this as the latest commit "Fix line endings (with dos2unix) and bump version to 1.2.1" I will do this. Sorry I can't vote you up. I am new here. – pteek Apr 13 '14 at 20:16
  • @pteek Excellent. I have included it in the answer for more visibilty. – VonC Apr 13 '14 at 20:17