Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #8223

Re: running an existing script

References (1 earlier) <4E00E3DB.9040900@stoneleaf.us> <SNT109-W44DCBD6223E4A2C5492ECAE6510@phx.gbl> <mailman.238.1308682012.1164.python-list@python.org> <44f694fd-c075-41a3-a044-c1b05f2a1463@x38g2000pri.googlegroups.com> <2d53da9c-0a28-4f88-b786-f18a3d0f4f11@f2g2000yqh.googlegroups.com>
Date 2011-06-22 09:13 -0700
Subject Re: running an existing script
From Chris Rebert <clp2@rebertia.com>
Newsgroups comp.lang.python
Message-ID <mailman.288.1308759230.1164.python-list@python.org> (permalink)

Show all headers | View raw


On Wed, Jun 22, 2011 at 8:54 AM, Adam Chapman
<adamchapman1985@hotmail.co.uk> wrote:
<snip>
> I've added the python directories to the environment variable "path"
> in my computer (http://showmedo.com/videotutorials/video?
> name=960000&fromSeriesID=96), which means I can now call python from
> the windows DOS-style command prompt.
>
> My formatting must be wrong when calling the nfold.py script to run.

No, it's a syntax error in the script itself, at least under the
version of Python you're using.

> My connad prompt call and the computer's response look like this:
>
> C:\Users\Adam\Desktop\JBOOST\jboost-2.2\jboost-2.2\scripts>nfold.py
> nfold.py
>  File "C:\Users\Adam\Desktop\JBOOST\jboost-2.2\jboost-2.2\scripts
> \nfold.py", line 13
>    print 'Usage: nfold.py <--booster=boosttype> <--folds=number> [--
> generate | --dir=dir] [--data=file --spec=file] [--rounds=number --
> tree=treetype]'
>
> ^
> SyntaxError: invalid syntax

You're probably running Python 3.x, which changed `print` from a
keyword to just a regular function; hence, `print foo` is illegal, and
one must write `print(foo)` instead.
Based on this, I'd say that nfold.py was written for Python 2.x rather
than Python 3.x; so you'll either need to port it to Python 3.x, or
install Python 2.x and run it under that.

Cheers,
Chris
--
http://rebertia.com

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

running an existing script Adam Chapman <adamchapman1985@hotmail.co.uk> - 2011-06-21 10:45 -0700
  Re: running an existing script Ethan Furman <ethan@stoneleaf.us> - 2011-06-21 11:32 -0700
  Re: running an existing script Benjamin Kaplan <benjamin.kaplan@case.edu> - 2011-06-21 11:25 -0700
  Re: running an existing script Ethan Furman <ethan@stoneleaf.us> - 2011-06-21 12:00 -0700
    Re: running an existing script Adam Chapman <adamchapman1985@hotmail.co.uk> - 2011-06-21 13:12 -0700
      Re: running an existing script Adam Chapman <adamchapman1985@hotmail.co.uk> - 2011-06-22 08:54 -0700
        Re: running an existing script Chris Rebert <clp2@rebertia.com> - 2011-06-22 09:13 -0700
        Re: running an existing script Ethan Furman <ethan@stoneleaf.us> - 2011-06-22 09:35 -0700
        Re: running an existing script Adam Chapman <adamchapman1985@hotmail.co.uk> - 2011-06-22 09:15 -0700
          Re: running an existing script Ethan Furman <ethan@stoneleaf.us> - 2011-06-22 09:51 -0700
            Re: running an existing script Adam Chapman <adamchapman1985@hotmail.co.uk> - 2011-06-22 09:51 -0700
              Re: running an existing script Adam Chapman <adamchapman1985@hotmail.co.uk> - 2011-06-22 10:13 -0700
                Re: running an existing script Ethan Furman <ethan@stoneleaf.us> - 2011-06-22 10:46 -0700
                Re: running an existing script Adam Chapman <adamchapman1985@hotmail.co.uk> - 2011-06-22 10:54 -0700
                Re: running an existing script Ethan Furman <ethan@stoneleaf.us> - 2011-06-22 11:50 -0700

csiph-web