element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum Problem with Python 3
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 8 replies
  • Subscribers 663 subscribers
  • Views 590 views
  • Users 0 members are here
  • python
  • raspberry_pi
Related

Problem with Python 3

Former Member
Former Member over 9 years ago

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.

  • Sign in to reply
  • Cancel
  • balearicdynamics
    0 balearicdynamics over 9 years ago

    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

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • balearicdynamics
    0 balearicdynamics over 9 years ago

    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

     

    https://youtu.be/8qxKYnAsNuU

    (I am not used to follow software tutorials on video but this is almost well done)

     

    Enrico

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 9 years ago in reply to balearicdynamics

    Thank you Enrico,

     

    I shall take all of that on board and fingers crossed, I might make it work lol.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • balearicdynamics
    0 balearicdynamics over 9 years ago in reply to Former Member

    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

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 9 years ago in reply to balearicdynamics

    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.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • balearicdynamics
    0 balearicdynamics over 9 years ago in reply to Former Member

    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

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 9 years ago in reply to balearicdynamics

    How do i attach photo of it not working Enrico?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • balearicdynamics
    0 balearicdynamics over 9 years ago in reply to Former Member

    Hi Richard,

     

    just press the camera icon on the toolbar of the editor of your post (edit it as many times as you need)

    image

     

    Then select the image you want from your computer of from the web in the next dialog

    image

    Press the Insert image button and ... that's all!

    (I'm going to sleep, I will answer you tomorrow morning).

     

    Cheers. Enrico

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube