Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems running upgrade.py for Windows7 #22

Open
t2k opened this issue Jul 9, 2014 · 8 comments
Open

Problems running upgrade.py for Windows7 #22

t2k opened this issue Jul 9, 2014 · 8 comments

Comments

@t2k
Copy link

t2k commented Jul 9, 2014

Hi, I was able to successfully upgrade a project to Marionette 2.0.1 in Linux but I'm having problems with a similar project in my Windows7 environment.

Windows7 seems to be having problems with the print statement in line #27

I installed Python 2.7.8

I've tried both the DOS cmd console and the git/bash console. It no worky...

upgrade py output

Any ideas?

@CNSKnight
Copy link

Download and unpack colorama (currently v.0.3.1)

cd into the directory where unpacked
run:
build
then:
install

in your upgrade.py, include the following just below the line codemod = "./bin/codemod.py"

from colorama import init
init()

While this gets rid of the color codes in stdout, I get no actual decoration in Win7 terminal :|

@CNSKnight
Copy link

Oh and I actually got it to run by changing that codemod = "./bin/codemod.py" line to:
codemod = "bin\codemod.py"
(windows only of course)

@samccone
Copy link
Member

yeah ./ is bad in windows :| I am sure there is a way to fix this

@jamiebuilds
Copy link
Member

https://docs.python.org/2/library/os.path.html

os.path.join(os.path.abspath(__file__), '..', '..', 'file_two_levels_up_from_me.txt'))

samccone added a commit that referenced this issue Jul 15, 2014
@samccone
Copy link
Member

@CNSKnight see #23

samccone added a commit that referenced this issue Jul 15, 2014
samccone added a commit that referenced this issue Jul 15, 2014
@Ratikant01
Copy link

Hello,
Can anyone please let me know why this patch is not replacing/updating anything in my project? I am using python 2.7.8 and few changes as below (as per above discussion)

  1. #!C:\Python27\python.exe (in both upgrade.py and codemod.py files)
  2. codemod = "bin\codemod.py" (in upgrade.py file)

image

Thanks a lot...

@kennyyyb
Copy link

I'm having a similar issue to the above (Windows 7 with Python 2.7 installed) - none of the changes are being made to the files and I receive errors as shown below.

In upgrade.py I made the change
codemod = "bin\codemod.py"

The attached image shows my issue (NB. I added two print statements to upgrade.py at approx. line 49 to try to figure out what was going on - I haven't used python before).

if good: cmd = ("%s -m --extensions js,coffee -d %s %s %s" % (codemod, args.path, search, replace)) print "COMMAND" print cmd print "\n\n" system(cmd)

upgrade-error

Anyone have any suggestions?

@wsrast
Copy link

wsrast commented Aug 18, 2016

I'm having the same problem, after following the instructions here. Prior to following those instructions, I was getting "cannot find the file specified" errors.

I've looked into the command that it's running, and it looks like the issue may be the ' characters it's using for bounding the search and replace strings:

python C:\sources\Marionette.Upgrade\bin\codemod.py -m --extensions js,coffee -
d C:\sources\Common\JS\Base '(.|@)close(' '\1destroy('

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants