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

Python 3.2.5. TypeError: Type str doesn't support the buffer API #246

Closed
40fixer opened this Issue Apr 11, 2014 · 8 comments

Comments

Projects
None yet
2 participants
@40fixer

40fixer commented Apr 11, 2014

When I try to open an existing local repo, I get the following error:

Traceback (most recent call last):
File "E:\Program Files (E)\git-cola\bin\git-cola.py", line 357, in
sys.exit(main())
File "E:\Program Files (E)\git-cola\bin\git-cola.py", line 71, in main
return args.func(args)
File "E:\Program Files (E)\git-cola\bin\git-cola.py", line 213, in cmd_cola
view = MainView(context.model)
File "E:\Program Files (E)\git-cola\share\git-cola\lib\cola\widgets\main.py",
line 81, in init
self.browser_dockable = (cfg.get('cola.browserdockable') or
File "E:\Program Files (E)\git-cola\share\git-cola\lib\cola\gitcfg.py", line 1
97, in get
return self._get(self._all, key, default)
File "E:\Program Files (E)\git-cola\share\git-cola\lib\cola\gitcfg.py", line 1
84, in _get
self.update()
File "E:\Program Files (E)\git-cola\share\git-cola\lib\cola\gitcfg.py", line 1
17, in update
self._read_configs()
File "E:\Program Files (E)\git-cola\share\git-cola\lib\cola\gitcfg.py", line 1
46, in _read_configs
self.read_config(self._config_files['user']))
File "E:\Program Files (E)\git-cola\share\git-cola\lib\cola\gitcfg.py", line 1
59, in read_config
config_lines = self.git.config(_args)[STDOUT].split('\0')
File "E:\Program Files (E)\git-cola\share\git-cola\lib\cola\git.py", line 136,
in
return lambda *args, *_kwargs: self._call_process(name, _args, *_kwargs)
File "E:\Program Files (E)\git-cola\share\git-cola\lib\cola\git.py", line 227,
in _call_process
return self.execute(call, *__kwargs)
File "E:\Program Files (E)\git-cola\share\git-cola\lib\cola\git.py", line 175,
in execute
*_extra)
File "E:\Program Files (E)\git-cola\share\git-cola\lib\cola\core.py", line 125
, in run_command
process = start_command(cmd, _args, *_kwargs)
File "E:\Program Files (E)\git-cola\share\git-cola\lib\cola\decorators.py", li
ne 20, in _caller
return caller(f, _args, *_opts)
File "E:\Program Files (E)\git-cola\share\git-cola\lib\cola\decorators.py", li
ne 69, in interruptable
result = func(_args, *_opts)
File "E:\Program Files (E)\git-cola\share\git-cola\lib\cola\core.py", line 109
, in start_command
universal_newlines=universal_newlines)
File "C:\Python32\lib\subprocess.py", line 744, in init
restore_signals, start_new_session)
File "C:\Python32\lib\subprocess.py", line 936, in _execute_child
args = list2cmdline(args)
File "C:\Python32\lib\subprocess.py", line 564, in list2cmdline
needquote = (" " in arg) or ("\t" in arg) or not arg
TypeError: Type str doesn't support the buffer API

@davvid

This comment has been minimized.

Show comment
Hide comment
@davvid

davvid Apr 13, 2014

Member

This is a windows-only problem. From what I can tell, the reason this happens is because we pass shell=True on win32 when running git commands. I wonder whether we need it at all?

Clone the latest git-cola source and edit cola/git.py. On line 166 it should say: extra['shell'] = True. Comment out that line and run from the source tree. Does that fix it?

I'm led to believe that there's no reason to pass shell=True on win32 anymore. I don't actually remember why we were passing that (it may have been a holdover from GitPython) and since win32 is not my primary platform, I hadn't run into this issue.

Let me know if that works. If so we can remove that altogether since it's probably not needed.

Member

davvid commented Apr 13, 2014

This is a windows-only problem. From what I can tell, the reason this happens is because we pass shell=True on win32 when running git commands. I wonder whether we need it at all?

Clone the latest git-cola source and edit cola/git.py. On line 166 it should say: extra['shell'] = True. Comment out that line and run from the source tree. Does that fix it?

I'm led to believe that there's no reason to pass shell=True on win32 anymore. I don't actually remember why we were passing that (it may have been a holdover from GitPython) and since win32 is not my primary platform, I hadn't run into this issue.

Let me know if that works. If so we can remove that altogether since it's probably not needed.

@40fixer

This comment has been minimized.

Show comment
Hide comment
@40fixer

40fixer Apr 13, 2014

No, it doen't. The same traceback. I have checked it on two different PC working under Windows 7.

40fixer commented Apr 13, 2014

No, it doen't. The same traceback. I have checked it on two different PC working under Windows 7.

@davvid

This comment has been minimized.

Show comment
Hide comment
@davvid

davvid Apr 14, 2014

Member

Ok, thanks for the note.

The root of the problem is that I don't have any windows machines available ;-) I tried installing python3 and friends on my 💩 win2k VM and that OS is no longer supported. bummer. (Is there a free version of windows I can install in a VM? maybe wine would work?) I probably won't look into it any further (even though the fix is probably simple).

Anyways, you don't care about that. You care about how to make it work. If you're on Windows then use Python 2.7.x. I don't have time to deal with python3 on windows right now, but will happily accept patches to fix it.

Member

davvid commented Apr 14, 2014

Ok, thanks for the note.

The root of the problem is that I don't have any windows machines available ;-) I tried installing python3 and friends on my 💩 win2k VM and that OS is no longer supported. bummer. (Is there a free version of windows I can install in a VM? maybe wine would work?) I probably won't look into it any further (even though the fix is probably simple).

Anyways, you don't care about that. You care about how to make it work. If you're on Windows then use Python 2.7.x. I don't have time to deal with python3 on windows right now, but will happily accept patches to fix it.

@davvid

This comment has been minimized.

Show comment
Hide comment
@davvid

davvid Apr 14, 2014

Member

README.md only mentions Python2 for Windows so that's the answer, otherwise I would have updated it to mention this.

Member

davvid commented Apr 14, 2014

README.md only mentions Python2 for Windows so that's the answer, otherwise I would have updated it to mention this.

@davvid davvid closed this Apr 14, 2014

@davvid

This comment has been minimized.

Show comment
Hide comment
@davvid

davvid Apr 15, 2014

Member

Through some incredible gymnastics I was able to get Python3 + PyQt running under wine. Re-opening.

Member

davvid commented Apr 15, 2014

Through some incredible gymnastics I was able to get Python3 + PyQt running under wine. Re-opening.

@davvid davvid reopened this Apr 15, 2014

@davvid davvid closed this in 1109aeb Apr 15, 2014

@40fixer

This comment has been minimized.

Show comment
Hide comment
@40fixer

40fixer Apr 15, 2014

I'm not shure wether it's a bug or just my fail. After 1109aeb the issue #246 disappeared, but now I get another traceback:
Traceback (most recent call last):
File "E:\projects\git-cola\bin\git-cola.py", line 357, in
sys.exit(main())
File "E:\projects\git-cola\bin\git-cola.py", line 71, in main
return args.func(args)
File "E:\projects\git-cola\bin\git-cola.py", line 213, in cmd_cola
view = MainView(context.model, settings=args.settings)
File "E:\projects\git-cola\cola\widgets\main.py", line 82, in init
self.browser_dockable = (cfg.get('cola.browserdockable') or
File "E:\projects\git-cola\cola\gitcfg.py", line 197, in get
return self._get(self._all, key, default)
File "E:\projects\git-cola\cola\gitcfg.py", line 184, in _get
self.update()
File "E:\projects\git-cola\cola\gitcfg.py", line 117, in update
self._read_configs()
File "E:\projects\git-cola\cola\gitcfg.py", line 146, in _read_configs
self.read_config(self._config_files['user']))
File "E:\projects\git-cola\cola\gitcfg.py", line 159, in read_config
config_lines = self.git.config(_args)[STDOUT].split('\0')
File "E:\projects\git-cola\cola\git.py", line 136, in
return lambda *args, *_kwargs: self._call_process(name, _args, *_kwargs)
File "E:\projects\git-cola\cola\git.py", line 226, in _call_process
return self.execute(call, *__kwargs)
File "E:\projects\git-cola\cola\git.py", line 174, in execute
*_extra)
File "E:\projects\git-cola\cola\core.py", line 131, in run_command
process = start_command(cmd, _args, *_kwargs)
File "E:\projects\git-cola\cola\decorators.py", line 20, in _caller
return caller(f, _args, *_opts)
File "E:\projects\git-cola\cola\decorators.py", line 77, in interruptable
raise e
File "E:\projects\git-cola\cola\decorators.py", line 69, in interruptable
result = func(_args, *_opts)
File "E:\projects\git-cola\cola\core.py", line 115, in start_command
universal_newlines=universal_newlines)
File "C:\Python32\lib\subprocess.py", line 744, in init
restore_signals, start_new_session)
File "C:\Python32\lib\subprocess.py", line 977, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

I tried to run bin/git-cola.py with parameter --prompt, but after specifying the git repository I get the same traceback. If it can help, I can run the program and stop it in any place to see the current state of variables. Just tell me the file and the line.

40fixer commented Apr 15, 2014

I'm not shure wether it's a bug or just my fail. After 1109aeb the issue #246 disappeared, but now I get another traceback:
Traceback (most recent call last):
File "E:\projects\git-cola\bin\git-cola.py", line 357, in
sys.exit(main())
File "E:\projects\git-cola\bin\git-cola.py", line 71, in main
return args.func(args)
File "E:\projects\git-cola\bin\git-cola.py", line 213, in cmd_cola
view = MainView(context.model, settings=args.settings)
File "E:\projects\git-cola\cola\widgets\main.py", line 82, in init
self.browser_dockable = (cfg.get('cola.browserdockable') or
File "E:\projects\git-cola\cola\gitcfg.py", line 197, in get
return self._get(self._all, key, default)
File "E:\projects\git-cola\cola\gitcfg.py", line 184, in _get
self.update()
File "E:\projects\git-cola\cola\gitcfg.py", line 117, in update
self._read_configs()
File "E:\projects\git-cola\cola\gitcfg.py", line 146, in _read_configs
self.read_config(self._config_files['user']))
File "E:\projects\git-cola\cola\gitcfg.py", line 159, in read_config
config_lines = self.git.config(_args)[STDOUT].split('\0')
File "E:\projects\git-cola\cola\git.py", line 136, in
return lambda *args, *_kwargs: self._call_process(name, _args, *_kwargs)
File "E:\projects\git-cola\cola\git.py", line 226, in _call_process
return self.execute(call, *__kwargs)
File "E:\projects\git-cola\cola\git.py", line 174, in execute
*_extra)
File "E:\projects\git-cola\cola\core.py", line 131, in run_command
process = start_command(cmd, _args, *_kwargs)
File "E:\projects\git-cola\cola\decorators.py", line 20, in _caller
return caller(f, _args, *_opts)
File "E:\projects\git-cola\cola\decorators.py", line 77, in interruptable
raise e
File "E:\projects\git-cola\cola\decorators.py", line 69, in interruptable
result = func(_args, *_opts)
File "E:\projects\git-cola\cola\core.py", line 115, in start_command
universal_newlines=universal_newlines)
File "C:\Python32\lib\subprocess.py", line 744, in init
restore_signals, start_new_session)
File "C:\Python32\lib\subprocess.py", line 977, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

I tried to run bin/git-cola.py with parameter --prompt, but after specifying the git repository I get the same traceback. If it can help, I can run the program and stop it in any place to see the current state of variables. Just tell me the file and the line.

@davvid

This comment has been minimized.

Show comment
Hide comment
@davvid

davvid Apr 16, 2014

Member

The reason you get this is because on windows git isn't in your $PATH. So you have to use the --git-path parameter when calling git-cola. Pass --git-path or add git's bin/ directory to your $PATH and retry.

Member

davvid commented Apr 16, 2014

The reason you get this is because on windows git isn't in your $PATH. So you have to use the --git-path parameter when calling git-cola. Pass --git-path or add git's bin/ directory to your $PATH and retry.

@40fixer

This comment has been minimized.

Show comment
Hide comment
@40fixer

40fixer Apr 16, 2014

Thank you, this solved the problem

40fixer commented Apr 16, 2014

Thank you, this solved the problem

davvid added a commit to davvid/git-cola that referenced this issue Apr 18, 2014

git: print a helpful message when 'git' is not in $PATH
Related-to: #246
Signed-off-by: David Aguilar <davvid@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment