# git-p4, SyntaxError: invalid syntax

2 messages from 2008-12-02 to 2008-12-02. Participants: Gary Yang, Jason Foreman.
Thread: https://gitlist.dev/t/16563

## Gary Yang, 2008-12-02 19:08

Subject: git-p4, SyntaxError: invalid syntax
Message-ID: <186027.87419.qm@web37901.mail.mud.yahoo.com>
URL: https://gitlist.dev/e/186027.87419.qm%40web37901.mail.mud.yahoo.com

```

I got git-p4 from “git clone git://git.kernel.org/pub/scm/git/git.git git”
I copied git-p4 from contrib/fast-import/git-p4 to /home/gyang/bin

I got SyntaxError  when I ran,

git-p4 clone //depot/Workshop

/home/gyang/bin/git-p4:161: Warning: 'yield' will become a reserved keyword in the future
  File "/user/svdc/pluo/bin/git-p4", line 161
    yield pattern
                ^
SyntaxError: invalid syntax

I opened the file, git-p4. There are three import lines. I am not python programmer. Maybe I missed something in python? I have python installed at /usr/local/bin/python

which python
/usr/local/bin/python

vi git-p4
import optparse, sys, os, marshal, popen2, subprocess, shelve
import tempfile, getopt, sha, os.path, time, platform
import re

Can someone tell me what I missed?

Thanks.




      

```

## Jason Foreman, 2008-12-02 19:45

Subject: Re: git-p4, SyntaxError: invalid syntax
Message-ID: <f9aa767e0812021145v1ecc9c56k6ad06ac7678e3d0d@mail.gmail.com>
URL: https://gitlist.dev/e/f9aa767e0812021145v1ecc9c56k6ad06ac7678e3d0d%40mail.gmail.com
In-Reply-To: <186027.87419.qm@web37901.mail.mud.yahoo.com>

```
On Tue, Dec 2, 2008 at 1:08 PM, Gary Yang <garyyang6@yahoo.com> wrote:
>
> /home/gyang/bin/git-p4:161: Warning: 'yield' will become a reserved keyword in the future
>  File "/user/svdc/pluo/bin/git-p4", line 161
>    yield pattern
>                ^
> SyntaxError: invalid syntax
>

This seems to indicate that your python doesn't support the "yield"
keyword (used in generators).

Are you using Python 2.2?  If so, that is a very old Python and I'd
recommend upgrading.  But even with 2.2 you can fix this by adding the
following import line:

from __future__ import generators

I'm not familiar with the git-p4 file specifically but the above
should hopefully fix your problem.


Cheers,

Jason

```
