git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git p4 sync: "str expected, not %s"

From
MBMassimo B. <massimo.b@gmx.net>
Date
Jul 17, 2019, 10:54 UTC
Message-ID
<61d7947142367c3abf6d6f0af60181a0677ce954.camel@gmx.net>
In-Reply-To
<23610851562985541@iva7-634c9cb1f49d.qloud-c.yandex.net>
Still failing:
On Fri, 2019-07-12 at 22:39 -0400, Andrey wrote:
Show 24 quoted lines
> Could you, please, try the patch below?
>
> diff --git a/git-p4.py b/git-p4.py
> index 5b79920f46..f5be048348 100755
> --- a/git-p4.py
> +++ b/git-p4.py
> @@ -4137,13 +4137,13 @@ def main():
>      if cmd.needsGit:
>          if cmd.gitdir == None:
>              cmd.gitdir = os.path.abspath(".git")
>              if not isValidGitDir(cmd.gitdir):
>                  # "rev-parse --git-dir" without arguments will try $PWD/.git
> -                cmd.gitdir = read_pipe("git rev-parse --git-dir").strip()
> +                cmd.gitdir = read_pipe("git rev-parse --git-
> dir").strip().decode()
>                  if os.path.exists(cmd.gitdir):
> -                    cdup = read_pipe("git rev-parse --show-cdup").strip()
> +                    cdup = read_pipe("git rev-parse --show-
> cdup").strip().decode()
>                      if len(cdup) > 0:
>                          chdir(cdup);
>
>          if not isValidGitDir(cmd.gitdir):
>              if isValidGitDir(cmd.gitdir + "/.git"):
# git p4 sync
Traceback (most recent call last):
  File "/usr/libexec/git-core/git-p4", line 4163, in <module>
    main()
  File "/usr/libexec/git-core/git-p4", line 4157, in main
    if not cmd.run(args):
  File "/usr/libexec/git-core/git-p4", line 3569, in run
    branches = p4BranchesInGit(self.importIntoRemotes)
  File "/usr/libexec/git-core/git-p4", line 844, in p4BranchesInGit
    if not line.startswith('p4/'):
TypeError: startswith first arg must be bytes or a tuple of bytes, not str
Show 18 quoted lines
> Or, even this one:
>
> diff --git a/git-p4.py b/git-p4.py
> index 5b79920f46..2bf6720911 100755
> --- a/git-p4.py
> +++ b/git-p4.py
> @@ -196,6 +196,10 @@ def read_pipe_full(c):
>      expand = isinstance(c,basestring)
>      p = subprocess.Popen(c, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
> shell=expand)
>      (out, err) = p.communicate()
> +    if out is not None:
> +        out = out.decode()
> +    if err is not None:
> +        err = err.decode()
>      return (p.returncode, out, err)
>
>  def read_pipe(c, ignore_error=False):
# git p4 sync
Traceback (most recent call last):
  File "/usr/libexec/git-core/git-p4", line 4167, in <module>
    main()
  File "/usr/libexec/git-core/git-p4", line 4146, in main
    cmd.gitdir = read_pipe("git rev-parse --git-dir").strip().decode()
AttributeError: 'str' object has no attribute 'decode'

Best regards, Massimo

Previous: Massimo B.
Message 3 of 3 in “git p4 sync: "str expected, not %s"”
  1. Massimo B.Jun 28, 2019
  2. Massimo B.Jul 12, 2019
  3. Massimo B.Jul 17, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.