質問編集履歴

6

修正後のコードを追記

2018/03/08 04:30

投稿

BURI55
BURI55

スコア25

test CHANGED
File without changes
test CHANGED
@@ -196,6 +196,26 @@
196
196
 
197
197
  ```
198
198
 
199
+ 修正後、import localeは追記してあります。
200
+
201
+ ```
202
+
203
+ if sys.version_info >= (3,):
204
+
205
+ def console_to_str(s):
206
+
207
+ # try:
208
+
209
+ # return s.decode(sys.__stdout__.encoding)
210
+
211
+ # except UnicodeDecodeError:
212
+
213
+ # return s.decode('utf_8')
214
+
215
+ return s.decode(locale.getpreferredencoding() or "utf-8", 'replace')
216
+
217
+ ```
218
+
199
219
  ### 試したこと
200
220
 
201
221
 

5

追記

2018/03/08 04:30

投稿

BURI55
BURI55

スコア25

test CHANGED
File without changes
test CHANGED
@@ -204,6 +204,8 @@
204
204
 
205
205
  https://qiita.com/ruteshi_SI_shiteru/items/be6a58276bdbd67dc096
206
206
 
207
+ によるpipの書き直し
208
+
207
209
  pipの入れ直し
208
210
 
209
211
  スペースの見直し

4

ソース追加

2018/03/08 04:24

投稿

BURI55
BURI55

スコア25

test CHANGED
File without changes
test CHANGED
@@ -120,6 +120,10 @@
120
120
 
121
121
  ```
122
122
 
123
+ を実行しました。
124
+
125
+ 修正したのは、tryから4行をコメントアウトしました。
126
+
123
127
  ```
124
128
 
125
129
  if sys.version_info >= (3,):
@@ -144,6 +148,52 @@
144
148
 
145
149
  return s
146
150
 
151
+
152
+
153
+ else:
154
+
155
+ def console_to_str(s):
156
+
157
+ return s
158
+
159
+
160
+
161
+ def native_str(s, replace=False):
162
+
163
+ # Replace is ignored -- unicode to UTF-8 can't fail
164
+
165
+ if isinstance(s, text_type):
166
+
167
+ return s.encode('utf-8')
168
+
169
+ return s
170
+
171
+
172
+
173
+
174
+
175
+ def total_seconds(td):
176
+
177
+ if hasattr(td, "total_seconds"):
178
+
179
+ return td.total_seconds()
180
+
181
+ else:
182
+
183
+ val = td.microseconds + (td.seconds + td.days * 24 * 3600) * 10 ** 6
184
+
185
+ return val / 10 ** 6
186
+
187
+
188
+
189
+
190
+
191
+ def get_path_uid(path):
192
+
193
+ """
194
+
195
+ Return path's uid.
196
+
147
197
  ```
148
198
 
149
199
  ### 試したこと

3

ソースコード追加

2018/03/08 04:08

投稿

BURI55
BURI55

スコア25

test CHANGED
File without changes
test CHANGED
@@ -120,7 +120,31 @@
120
120
 
121
121
  ```
122
122
 
123
+ ```
123
124
 
125
+ if sys.version_info >= (3,):
126
+
127
+ def console_to_str(s):
128
+
129
+ try:
130
+
131
+ return s.decode(sys.__stdout__.encoding)
132
+
133
+ except UnicodeDecodeError:
134
+
135
+ return s.decode('utf_8')
136
+
137
+
138
+
139
+ def native_str(s, replace=False):
140
+
141
+ if isinstance(s, bytes):
142
+
143
+ return s.decode('utf-8', 'replace' if replace else 'strict')
144
+
145
+ return s
146
+
147
+ ```
124
148
 
125
149
  ### 試したこと
126
150
 

2

実行結果

2018/03/08 04:04

投稿

BURI55
BURI55

スコア25

test CHANGED
File without changes
test CHANGED
@@ -82,6 +82,34 @@
82
82
 
83
83
  ```
84
84
 
85
+ スペースやタブを見直したところ以下のエラーになりました。
86
+
87
+ ```
88
+
89
+ Traceback (most recent call last):
90
+
91
+ File "C:\Users\KHB15\Anaconda3\Scripts\pip-script.py", line 6, in <module>
92
+
93
+ from pip import main
94
+
95
+ File "C:\Users\KHB15\Anaconda3\lib\site-packages\pip\__init__.py", line 26, in <module>
96
+
97
+ from pip.utils import get_installed_distributions, get_prog
98
+
99
+ File "C:\Users\KHB15\Anaconda3\lib\site-packages\pip\utils\__init__.py", line 22, in <module>
100
+
101
+ from pip.compat import console_to_str, expanduser, stdlib_pkgs
102
+
103
+ File "C:\Users\KHB15\Anaconda3\lib\site-packages\pip\compat\__init__.py", line 78
104
+
105
+ def native_str(s, replace=False):
106
+
107
+ ^
108
+
109
+ IndentationError: expected an indented block
110
+
111
+ ```
112
+
85
113
  ### 該当のソースコード
86
114
 
87
115
 
@@ -102,7 +130,9 @@
102
130
 
103
131
  https://qiita.com/ruteshi_SI_shiteru/items/be6a58276bdbd67dc096
104
132
 
133
+ pipの入れ直し
105
134
 
135
+ スペースの見直し
106
136
 
107
137
  ### 補足情報(FW/ツールのバージョンなど)
108
138
 

1

実行結果

2018/03/08 02:58

投稿

BURI55
BURI55

スコア25

test CHANGED
File without changes
test CHANGED
@@ -38,7 +38,49 @@
38
38
 
39
39
  ```
40
40
 
41
+ Pipを更新してみたところ以下のエラーになりました。
41
42
 
43
+ ```
44
+
45
+ Collecting pysptk
46
+
47
+ Using cached pysptk-0.1.10.tar.gz
48
+
49
+ Complete output from command python setup.py egg_info:
50
+
51
+ Traceback (most recent call last):
52
+
53
+ File "<string>", line 1, in <module>
54
+
55
+ File "C:\Users\KHB15\AppData\Local\Temp\pip-build-qtdykif9\pysptk\setup.py", line 25, in <module>
56
+
57
+ ['git', 'rev-parse', 'HEAD'], cwd=cwd).decode('ascii').strip()
58
+
59
+ File "C:\Users\KHB15\Anaconda3\lib\subprocess.py", line 316, in check_output
60
+
61
+ **kwargs).stdout
62
+
63
+ File "C:\Users\KHB15\Anaconda3\lib\subprocess.py", line 383, in run
64
+
65
+ with Popen(*popenargs, **kwargs) as process:
66
+
67
+ File "C:\Users\KHB15\Anaconda3\lib\subprocess.py", line 676, in __init__
68
+
69
+ restore_signals, start_new_session)
70
+
71
+ File "C:\Users\KHB15\Anaconda3\lib\subprocess.py", line 957, in _execute_child
72
+
73
+ startupinfo)
74
+
75
+ FileNotFoundError: [WinError 2] 指定されたファイルが見つかりません。
76
+
77
+
78
+
79
+ ----------------------------------------
80
+
81
+ Command "python setup.py egg_info" failed with error code 1 in C:\Users\KHB15\AppData\Local\Temp\pip-build-qtdykif9\pysptk\
82
+
83
+ ```
42
84
 
43
85
  ### 該当のソースコード
44
86