Hi Joe (sorry for delay, I took the weekend off. BTW, on a totally different note, why is the date showing March 29 on last reply??),
Yes, you're absolutely right, it's a Python version thing. I started my session in Python 3.x and so the examples in the web2py book weren't working as it seems they're based off Python 2.x (I was getting: > SyntaxError: invalid syntax. My question is how to update the book so that super noobs like me won't trip over the same thing. It would just need a line mentioning that in Python 3, you'd have to do it 'X' way (and how to check which version you're using). Or something like that. Would we try a pull request to try an update or just mention in this space and someone will attend to it? On Friday, March 29, 2019 at 8:39:02 PM UTC-4, Joe Barnhart wrote: > > I suspect you were actually running Python 3.x in which case "print xxx" > doesn't work because print has been mad into a function (requiring > parentheses). When I start each on my Mac, this is the display I get: > > Python 2.7: > > ssmain:~ jbarnhart$ python > > Python 2.7.10 (default, Feb 22 2019, 21:17:52) > > [GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14)] on darwin > > Type "help", "copyright", "credits" or "license" for more information. > > >>> > > > Python 3.7: > > ssmain:~ jbarnhart$ > > ssmain:~ jbarnhart$ python3 > > Python 3.7.2 (default, Feb 12 2019, 08:15:36) > > [Clang 10.0.0 (clang-1000.11.45.5)] on darwin > > Type "help", "copyright", "credits" or "license" for more information. > > >>> > > You should be able to tell the version by the startup message. If you are > actually running Python 2 and the code fails, copy and paste the actual > error message you get and we'll puzzle it out. > > Warm regards, > Joe > > > > > On Friday, March 29, 2019 at 7:32:52 AM UTC-7, Al Hart wrote: >> >> Hi Joe, >> >> Thanks so much for responding. Let me be more specific. I was referring >> to a section in the book, chapter two, on types >> <http://web2py.com/books/default/chapter/29/02/the-python-language#Types> >> . >> In there it suggests >> >> >>> a = 3>>> print type(a)<type 'int'> >>> >>> But that didn't work for me, I got error messages (don't recall what >> they were at this moment). >> However, when I tried it using two other methods... >> 1. >> >>> >>> a = 3 >> >> >>> type(a) >> >> or >> 2. >> >>> >>> a = 3 >> >> >>> print(type(a)) >> >> >> Both of those worked for me. Kind of weird because when I checked which >> version of python I had running it said 2.7 but perhaps I installed w2p >> with python3. >> >> Anyway, at the end I was suggesting that maybe we could update the book >> some making reference to how things might look with python3. I wasn't sure >> if that sort of thing is just done here, by mentioning it in the forum and >> someone will get to it, or if it might be done by pull request. >> >> Best, >> >> Al >> >> On Thu, Mar 28, 2019 at 9:30 PM Joe Barnhart <joe.b...@gmail.com> wrote: >> >>> Hi Al -- >>> >>> First off, welcome to the web2py group. Next, it's not clear from your >>> message just what the question is. If you can elaborate on (a) what you >>> did, (b) what you expected, and (c) what you got, I'm sure someone here can >>> help >>> >>> Warm regards, >>> >>> Joe B. >>> >>> On Thursday, March 28, 2019 at 2:10:50 AM UTC-7, Al Hart wrote: >>>> >>>> Hi folks, if you'll pardon the corny title, I am brand new to web2py >>>> (so excited to discover it) and I'm just working may way through the book. >>>> In Chapter two, the section on types, I tried to run the examples, but I >>>> got error messages. Googling around it seemed to work better if I went one >>>> of two ways: >>>> >>>> >>>> 1. a = 3 >>>> type(a) >>>> 2. a = 4 >>>> print(type(a)) >>>> >>>> >>>> I'm on Ubuntu 18.04. Not sure if the example is based on python 3? If >>>> not, is this the best way to suggest updates to the book or should we just >>>> try a pull request? >>>> >>> -- >>> Resources: >>> - http://web2py.com >>> - http://web2py.com/book (Documentation) >>> - http://github.com/web2py/web2py (Source code) >>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>> --- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "web2py-users" group. >>> To unsubscribe from this topic, visit >>> https://groups.google.com/d/topic/web2py/VityJ20AV2M/unsubscribe. >>> To unsubscribe from this group and all its topics, send an email to >>> web...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.