suhongrui / python-multitask

Automatically exported from code.google.com/p/python-multitask
0 stars 0 forks source link

Multitasking #4

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. After I ran this process
      from multitask import *
>>>   def printer(message):
...       while True:
...           print(message)
...           yield
... 
>>>   multitask.add(printer('hello'))
>>>   multitask.add(printer('goodbye'))
>>>   multitask.run()
2. It show up some error message
      Traceback (most recent call last):
      File "C:/Python33/test.py", line 1, in <module>
      from multitask import *
      File "C:/Python33\multitask.py", line 847
      except StopIteration, e:
                        ^
      SyntaxError: invalid syntax
3. What to do ?

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by pucompon...@gmail.com on 17 Dec 2013 at 5:31

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
You are importing everything from "multitask" without the namespace "multitask".
You try at line 7 to run "add" from "multitask", but the namespace doesnt 
exist...

So, you can run functions of "multitask" directly (without to call the 
namespace, as example just "add(printer('hello')")

or (better solution):

just remove "from x import y" and retry with "import multitask"

Original comment by Raymond....@gmail.com on 2 May 2014 at 10:02

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
This has nothing to do with namespace, this is related to python3 syntax 
changes. Use python2 and everything will work without any issues.

Original comment by leonardo...@gmail.com on 7 May 2014 at 8:10