Can anyone tell me why Python 3 on my Raspberry pi is refusing to import turtle and other functions? It just keeps coming up with errors, either cannot connect to a subprocessor or saying words such as 'forward' is not defined.
Many thanks.
Can anyone tell me why Python 3 on my Raspberry pi is refusing to import turtle and other functions? It just keeps coming up with errors, either cannot connect to a subprocessor or saying words such as 'forward' is not defined.
Many thanks.
Hello Richard,
on Raspberry PI there are components in python2, 2.7, 3 and 3.5 (if I am not wrong but maybe 3.7). When python passed from version 2.x to 3.0.x they (yes, it happened) changed the syntax. As a matter of fact you can't adopt the same import syntax between the two versions but should realign the component sources to work with python 3 instead of previous 2.x versions. In some cases this is a simple job, in some other it is a mess.
I suggest to take a look to this page https://docs.python.org/2/library/2to3.html where you can see almost all explained and good links. Not only but "in theory" the conversion provided from 2 to 3 has some issue and some exceptions but can be applied to all the sources. As the changes are not so few (and it is almost terrible to discover one by one or study again the entire python3 syntax changes) I god the most of the job with this tool when I had to convert old sources.
Enrico
Some other useful links:
https://docs.python.org/3/howto/pyporting.html
Supporting Python 2 and 3 without 2to3 conversion — Supporting Python 3 - The Book Site
(I am not used to follow software tutorials on video but this is almost well done)
Enrico
Thank you Enrico,
I shall take all of that on board and fingers crossed, I might make it work lol.
Sorry if I was so aggressive in my answer; I have not considered that the cause maybe different (I was thinking just now), for example a problem of installation. But I had the same problem and the solution is easier than discovering this detail...
Enrico
No worries , but raspberry pi comes with both python 2 and python 3 already installed on NOOBS , so I don't think it's a conversion problem, but il check out your recommended sites. Thanks for your help.
Let me know and eventually post the few lines of code where the problem is shown, the error list etc. Then we investigate in depth.
Enrico
How do i attach photo of it not working Enrico?
Hi Richard,
just press the camera icon on the toolbar of the editor of your post (edit it as many times as you need)
Then select the image you want from your computer of from the web in the next dialog
Press the Insert image button and ... that's all!
(I'm going to sleep, I will answer you tomorrow morning).
Cheers. Enrico