sbt package报错:a bytes-like object is required, not 'str'
Traceback (most recent call last): File "C:\Users\User\AppData\Local\Temp\protocbridge7256923893821185625.py", line 6, in <module> s.sendall(content) TypeError: a bytes-like object is required, not 'str' --scala_out: protoc-gen-scala: Plugin failed with status code 1. [error] java.lang.RuntimeException: protoc returned exit code: 1 [error] at scala.sys.package$.error(package.scala:26) [error] at sbtprotoc.ProtocPlugin$.compile(ProtocPlugin.scala:139) [error] at sbtprotoc.ProtocPlugin$.compileProto$1(ProtocPlugin.scala:180) [error] at sbtprotoc.ProtocPlugin$.$anonfun$sourceGeneratorTask$4(ProtocPlugin.scala:184) [error] at sbt.util.FileFunction$.$anonfun$cached$1(FileFunction.scala:73) [error] at sbt.util.FileFunction$.$anonfun$cached$4(FileFunction.scala:147) [error] at sbt.util.Difference.apply(Tracked.scala:313) [error] at sbt.util.Difference.apply(Tracked.scala:293) [error] at sbt.util.FileFunction$.$anonfun$cached$3(FileFunction.scala:143) [error] at sbt.util.Difference.apply(Tracked.scala:313) [error] at sbt.util.Difference.apply(Tracked.scala:288) [error] at sbt.util.FileFunction$.$anonfun$cached$2(FileFunction.scala:142) [error] at sbtprotoc.ProtocPlugin$.$anonfun$sourceGeneratorTask$1(ProtocPlugin.scala:190) [error] at scala.Function1.$anonfun$compose$1(Function1.scala:44) [error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:40) [error] at sbt.std.Transform$$anon$4.work(System.scala:67) [error] at sbt.Execute.$anonfun$submit$2(Execute.scala:269) [error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16) [error] at sbt.Execute.work(Execute.scala:278) [error] at sbt.Execute.$anonfun$submit$1(Execute.scala:269) [error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178) [error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:37) [error] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [error] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [error] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [error] at java.lang.Thread.run(Thread.java:748) [error] (Compile / protocGenerate) protoc returned exit code: 1 [error] Total time: 4 s, completed 2020-1-13 9:42:52
搜索了一下,根据https://github.com/scalapb/ScalaPB/issues/268的讨论,可能是安装的python版本问题,非2.x版本可能导致sbt package时出现上面的错误。安装python 2.7后问题解决。