teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

2

引用内で __main__ が表示されていなかったため、修正

2020/05/05 08:12

投稿

teamikl
teamikl

スコア8817

answer CHANGED
@@ -2,8 +2,10 @@
2
2
 
3
3
  [プロセスベースの並列処理](https://docs.python.org/ja/3/library/multiprocessing.html)
4
4
 
5
+ ```
5
6
  > このパッケージに含まれる機能を使用するためには、
6
7
  > 子プロセスから __main__ モジュールをインポートできる必要があります。
8
+ ```
7
9
 
8
10
  ----
9
11
  ## 解決策1: ThreadPool を使う

1

不要なコードの削除

2020/05/05 08:12

投稿

teamikl
teamikl

スコア8817

answer CHANGED
@@ -38,10 +38,6 @@
38
38
  def calculation(Num1, Num2):
39
39
  result = """ + Param + """
40
40
  return result
41
-
42
- if __name__ == "__main__":
43
- calculation(1, 2)
44
-
45
41
  """
46
42
  exec(spam_class, spam_module.__dict__)
47
43
  sys.modules['spam'] = spam_module