Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Python and the Pi

Python and the Pi

Scheduled Pinned Locked Moved The Lounge
pythonlinuxhardwarequestionlearning
24 Posts 12 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Nemanja Trifunovic

    Eh, it's not that bad. I actually like Python. Just stick with 2.7.x and make sure your editor converts tabs into spaces, you'll be fine.

    utf8-cpp

    Y Offline
    Y Offline
    Ygnaiih
    wrote on last edited by
    #5

    My tab does 4 spaces in Notepad++ and in the Pi IDE. Also I can't get global variables visible through out the scrip especially in If statements. I'm using 2.7 as well.

    1 Reply Last reply
    0
    • Y Ygnaiih

      Bought a Raspberry Pi and everything I can find about programming it calls for Python. So thinking, “How hard can learning a scripting language be?” I dove head long into it. Most of the code examples I have found are poop. Indenting makes me long for curly braces. Then there’s 2.7.9 and 3.4.3, where 3.4.3 is not backwardly compatible. Then there is the worship of the great Guido. BTW, seems that the Linux kiddies are using it in a large way. Bottom line is if I’m going to get anything out of the Pi, it’s just hack it and go. Sigh() { Response.write(“What do you mean unexpected indent!”); }

      F Offline
      F Offline
      Frank Alviani
      wrote on last edited by
      #6

      I prefer working in the Python3 branch. The newer facilities are nice, and I have no legacy code to maintain (a rare luxury :-D

      Sarcasm - it's not just a verbal skill - it's a lifestyle!

      1 Reply Last reply
      0
      • R R Giskard Reventlov

        What are 'spaces'?

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #7

        Things that women cannot reverse cars into. :cool:

        C 1 Reply Last reply
        0
        • Y Ygnaiih

          Bought a Raspberry Pi and everything I can find about programming it calls for Python. So thinking, “How hard can learning a scripting language be?” I dove head long into it. Most of the code examples I have found are poop. Indenting makes me long for curly braces. Then there’s 2.7.9 and 3.4.3, where 3.4.3 is not backwardly compatible. Then there is the worship of the great Guido. BTW, seems that the Linux kiddies are using it in a large way. Bottom line is if I’m going to get anything out of the Pi, it’s just hack it and go. Sigh() { Response.write(“What do you mean unexpected indent!”); }

          N Offline
          N Offline
          newton saber
          wrote on last edited by
          #8

          Allow me to insert my gratuitous self-promotion here AND answer your question. It just so happens I've written quite a few Python programs and I own a RPi -- anyone who knows anything about RPi knows that you refer to it as RPi. :D The thing is if you are trying to do stuff with a UI, then you are probably looking for Tkinter help. Tkinter is ugly. But, my point -- and I do have one -- is that my simple Tkinter examples, which I wrote on a PC with Python work with no changes on the RPi. Here's my self promotion: My book at amazon.com Learn Python, Think Python[^]. For all you downvoters: I'm answering a question about RPi. :D I really am.

          Y 1 Reply Last reply
          0
          • R R Giskard Reventlov

            What are 'spaces'?

            N Offline
            N Offline
            newton saber
            wrote on last edited by
            #9

            Karel Čapek wrote:

            What are 'spaces'?

            Yes, alas, Python uses spaces (whitespace) as a delimiter for code blocks. It is the most horrendous thing about Python. You will get (random) errors because of spacing problems in your code. agh! "Hey, let's use a non-printable char as the delimiter in our language.", Sincerely Guido Van Rossum The rest of the world, shouting.... Nooooooooooooooooooo!!!!!!!

            1 Reply Last reply
            0
            • N newton saber

              Allow me to insert my gratuitous self-promotion here AND answer your question. It just so happens I've written quite a few Python programs and I own a RPi -- anyone who knows anything about RPi knows that you refer to it as RPi. :D The thing is if you are trying to do stuff with a UI, then you are probably looking for Tkinter help. Tkinter is ugly. But, my point -- and I do have one -- is that my simple Tkinter examples, which I wrote on a PC with Python work with no changes on the RPi. Here's my self promotion: My book at amazon.com Learn Python, Think Python[^]. For all you downvoters: I'm answering a question about RPi. :D I really am.

              Y Offline
              Y Offline
              Ygnaiih
              wrote on last edited by
              #10

              I have called my Raspberry Pi many things. Some of them are not printable.

              N 1 Reply Last reply
              0
              • Y Ygnaiih

                I have called my Raspberry Pi many things. Some of them are not printable.

                N Offline
                N Offline
                newton saber
                wrote on last edited by
                #11

                Earl Owens wrote:

                Raspberry Pi

                You are going to have to start referring to it as RPi, okay? Otherwise I will think of you as a nube. :D

                Y 1 Reply Last reply
                0
                • Y Ygnaiih

                  Bought a Raspberry Pi and everything I can find about programming it calls for Python. So thinking, “How hard can learning a scripting language be?” I dove head long into it. Most of the code examples I have found are poop. Indenting makes me long for curly braces. Then there’s 2.7.9 and 3.4.3, where 3.4.3 is not backwardly compatible. Then there is the worship of the great Guido. BTW, seems that the Linux kiddies are using it in a large way. Bottom line is if I’m going to get anything out of the Pi, it’s just hack it and go. Sigh() { Response.write(“What do you mean unexpected indent!”); }

                  J Offline
                  J Offline
                  Jeremy Falcon
                  wrote on last edited by
                  #12

                  Earl Owens wrote:

                  How hard can learning a scripting language be?

                  Clearly, you've never done any hardcore JavaScript development.

                  Jeremy Falcon

                  Y 2 Replies Last reply
                  0
                  • N newton saber

                    Earl Owens wrote:

                    Raspberry Pi

                    You are going to have to start referring to it as RPi, okay? Otherwise I will think of you as a nube. :D

                    Y Offline
                    Y Offline
                    Ygnaiih
                    wrote on last edited by
                    #13

                    Yes o' master of RPi willco :)

                    N 1 Reply Last reply
                    0
                    • R R Giskard Reventlov

                      What are 'spaces'?

                      M Offline
                      M Offline
                      Maximilien
                      wrote on last edited by
                      #14

                      (sfw music (no)video) Space is only noise[^]

                      I'd rather be phishing!

                      1 Reply Last reply
                      0
                      • J Jeremy Falcon

                        Earl Owens wrote:

                        How hard can learning a scripting language be?

                        Clearly, you've never done any hardcore JavaScript development.

                        Jeremy Falcon

                        Y Offline
                        Y Offline
                        Ygnaiih
                        wrote on last edited by
                        #15

                        I use JavaScript only if I have to, but it is looking more and more there is no escaping it.

                        J 1 Reply Last reply
                        0
                        • Y Ygnaiih

                          Yes o' master of RPi willco :)

                          N Offline
                          N Offline
                          newton saber
                          wrote on last edited by
                          #16

                          I haven't done much that is interesting with the RPi, unfortunately. I have learned how to connect it directly to my PC via ethernet so I can SSH directly to it and don't have to have a separate screen. I need to work with the GPIO but I've been lazy so far.

                          1 Reply Last reply
                          0
                          • R R Giskard Reventlov

                            What are 'spaces'?

                            N Offline
                            N Offline
                            Nemanja Trifunovic
                            wrote on last edited by
                            #17

                            Karel Čapek wrote:

                            What are 'spaces'?

                            static_cast(0x20)

                            utf8-cpp

                            1 Reply Last reply
                            0
                            • L Lost User

                              Things that women cannot reverse cars into. :cool:

                              C Offline
                              C Offline
                              CHill60
                              wrote on last edited by
                              #18

                              Just saying clickety[^] ;P

                              L 1 Reply Last reply
                              0
                              • Y Ygnaiih

                                I use JavaScript only if I have to, but it is looking more and more there is no escaping it.

                                J Offline
                                J Offline
                                Jeremy Falcon
                                wrote on last edited by
                                #19

                                It's the future of the web man, may as well jump on board.

                                Jeremy Falcon

                                1 Reply Last reply
                                0
                                • C CHill60

                                  Just saying clickety[^] ;P

                                  L Offline
                                  L Offline
                                  Lost User
                                  wrote on last edited by
                                  #20

                                  Tory smear. ;P

                                  C 1 Reply Last reply
                                  0
                                  • L Lost User

                                    Tory smear. ;P

                                    C Offline
                                    C Offline
                                    CHill60
                                    wrote on last edited by
                                    #21

                                    :laugh:

                                    1 Reply Last reply
                                    0
                                    • Y Ygnaiih

                                      Bought a Raspberry Pi and everything I can find about programming it calls for Python. So thinking, “How hard can learning a scripting language be?” I dove head long into it. Most of the code examples I have found are poop. Indenting makes me long for curly braces. Then there’s 2.7.9 and 3.4.3, where 3.4.3 is not backwardly compatible. Then there is the worship of the great Guido. BTW, seems that the Linux kiddies are using it in a large way. Bottom line is if I’m going to get anything out of the Pi, it’s just hack it and go. Sigh() { Response.write(“What do you mean unexpected indent!”); }

                                      Kornfeld Eliyahu PeterK Offline
                                      Kornfeld Eliyahu PeterK Offline
                                      Kornfeld Eliyahu Peter
                                      wrote on last edited by
                                      #22

                                      Pi running Linux and Linux can have mono and mono can run any .NET language you choose... http://logicalgenetics.com/raspberry-pi-and-mono-hello-world/[^]

                                      Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

                                      "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

                                      1 Reply Last reply
                                      0
                                      • J Jeremy Falcon

                                        Earl Owens wrote:

                                        How hard can learning a scripting language be?

                                        Clearly, you've never done any hardcore JavaScript development.

                                        Jeremy Falcon

                                        Y Offline
                                        Y Offline
                                        Ygnaiih
                                        wrote on last edited by
                                        #23

                                        That was sarcasm. Yes I have wrestled the great bear JavaScript.

                                        1 Reply Last reply
                                        0
                                        • Y Ygnaiih

                                          Bought a Raspberry Pi and everything I can find about programming it calls for Python. So thinking, “How hard can learning a scripting language be?” I dove head long into it. Most of the code examples I have found are poop. Indenting makes me long for curly braces. Then there’s 2.7.9 and 3.4.3, where 3.4.3 is not backwardly compatible. Then there is the worship of the great Guido. BTW, seems that the Linux kiddies are using it in a large way. Bottom line is if I’m going to get anything out of the Pi, it’s just hack it and go. Sigh() { Response.write(“What do you mean unexpected indent!”); }

                                          enhzflepE Offline
                                          enhzflepE Offline
                                          enhzflep
                                          wrote on last edited by
                                          #24

                                          For what it's worth, you can also program it with C/C++. I use the same IDE (Code::Blocks) in Windows, x64 Linux and on the RasPi. In combination with wxWidgets and a wx design tool of your choice it makes for nice suite. The only thing I'm missing is a socket library on the old version of Raspian that I have.

                                          "When I was 5 years old, my mother always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down 'happy'. They told me I didn't understand the assignment, and I told them they didn't understand life." - John Lennon

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups