Why?
a, b = 0, 1
while b < 1000:
…print(b, end=‘,’)
…a, b = b, a+b
does not work in ghpython 0.6.0.3.
at the end of the tutorial
Why?
a, b = 0, 1
while b < 1000:
…print(b, end=‘,’)
…a, b = b, a+b
does not work in ghpython 0.6.0.3.
at the end of the tutorial
Rhino is using IronPython 2.7x, not Python 3.
I haven’t tried, but maybe you could try this:
Btw, in general, it would help if you attached the definition you are working on.
try this:
from __future__
import print_function
print(b, end=’,’)
Hey! From the future? What do you mean with future?
__future__
contains Python 3 functions that have been back-ported to v2
Please note that for some reason, the underscores were missing in my earlier post. I didn’t tag it as pre-formatted text.
Using __future__
will make it much easier to port to v3
2 posts were split to a new topic: Printing a tuple with a single item
Sorry, I do not understand how it works.
Do I have to install ‘future?’ What is port to v3?
Or did I missed it in the documentation?
https://docs.python.org/3/tutorial/controlflow.html
I am now studying paragraph 4.6 of the pyhton tutorial.
python -end- problem.gh (2.2 KB)
The error message on your component tells you what to do - __future__
imports are special and must be placed at the very top of the script.
Just reorder the first 3 lines to :
from __future__ import print_function
import math
import rhinoscriptsyntax as rs
and the rest works
PS. Rhino/Grasshopper only runs on IronPython 2.7.x, so you should be reading the Python 2 version of the tutorials, not Python 3.
Thank you