Why Python?
In short: it came highly recommended.
I’ve dabbled in C++ and Java in the past. C++ is nasty if you haven’t had any previous experience with coding and I just didn’t get into Java that much at the time. Python looks similar to Java and has very close principles, they are both high level, object-oriented coding languages. Despite these similarities, Python is much less complicated and uses syntax that you would use as a normal person and it makes a lot of sense when you look at it. Essentially, Python rocks.
The first hoop to jump through was getting the software to be able to code in Python. I looked at several IDE’s and since I already had Netbeans from my days of dabbling in Java it seemed easier to stick with that. I was wrong. The guides to get Python working in Netbeans were rather complicated and I couldn’t be assed faffing around with over complex crap at the time. Then I happened on a comment that Ubuntu has built-in programming tools for Python, Sweet! I’ve always wanted to try out Ubuntu so this was the perfect excuse.
So off I went to the land of Linux and installed Ubuntu on my computer. Boy was that easy! If you have ever tried to create a new partition on a hard drive that’s already rather full with Windows I’m sure you’ll know it’s not very simple. Not so with Ubuntu, during the install there is a nice little slider that I could drag left or right to allocate my remaining unused space to the Ubuntu partition. It was as easy as that. Big respect to the folks who programmed that wonderful feature. Windows is no way near as user-friendly when installing the OS.
Now with my shiny new install of Ubuntu it was time to get stuck into some Python. Next hurdle, enter stage left: finding good learning guides. This is harder than you would think. While there are countless guides on learning Python I quickly discovered that some are just downright rubbish, give you far too little info, or they start from scratch but seem to assume you already know how to code in Python, which makes no sense. I did find lots of great practice exercises but almost all of them didn’t have example answers, so if you get completely stuck you’re shafted.
In the end I found an online textbook and a site with some great exercises with the much-needed examples. I was a very happy chappy at this point. Between these two I have been getting some good schooling in the basics of coding Python. So far it’s been lots of fun, it appeals to me because it’s logical and makes sense. Logic and maths, I can handle this.
This leads me to my next hurdle, which isn’t really a hurdle at this point but it will be an issue down the track if I don’t figure it out. This wee hurdle goes by the rather ominous name of “chmod +x” and I had no idea what the hell it was. The textbook I am using made reference to this thingy when telling me about how to run a program I have written in Python. Problem, it just said to “run a chmod +x on the .py file to make it executable” …. um, excuse me? First, what is chmod +x? and secondly, how in the 7 hells do I “run a chmod +x”?
So I did some snooping (not in the textbook, it said nothing more on the matter) and discovered that this chmod +x changes the permissions on the file to magically transmute a lowly text file into an all-powerful executable in Ubuntu. Cool, now how do I do it? I’m still working on that but I think I know how it’s done. From what I have read it seems to be a command line operation in Ubuntu so all I need to do now is figure out how to use it. Then I can waltz around my command line like a god, zapping .py files into hulking executables at will. Mwahahahaha!
That’s all from me for now, I’ll be back with more Python shenanigans at some indeterminate time in the future.
Hail fellow Python newbie! I’ve been working on most of my Python stuff through Windows, but I have a bit of Unix experience to lend a hand here as well.
You can modify the permissions in a number of ways. For starters, you should be able to right-click and view the properties of the files in question and see the permissions. Another way to quickly see permissions is to do a ls -l command in the terminal. You’ll see the permissions on the left. The first 3 (skipping the first dash) is user, then group, then others. By doing a command like chmod +x *.py, you’ll give all users execute permissions to all files ending in .py. To give only yourself permissions, change the command to chmod u+x *.py.
After this is done, you should be able to execute your Python script by simply typing python .py.
I currently use Eclipse with PyDev and I really like it. I haven’t had really much exposure to too many IDEs or even developing without an IDE, but I’m satisfied with it. I even have a short blog post on it here: http://boonhammer.wordpress.com/2012/08/20/inside-look-eclipse-ide-and-pydev/.
Good luck! I’ll be following for sure.
Thanks Dale that’s some great advice that will serve me well. You are obviously much further ahead in the game than me, I’ve literally only got a handful of hours under my belt so far.
I’ve mooched through your post and like the sound of eclipse, it’ll probably be my IDE of choice if I end up coding in Windows. For now I’m happy with IDLE in Ubuntu, it is very easy to use. It looks like a simple text editor but has all of those nice features like syntax highlighting, code completion and can execute your code in a second window nice and easy.
You can use IDLE in Windows, too, if you need to. I’ve definitely liked IDLE for single file editing and the interpreter, but managing multiple files is painful. Something as simple as Sublime Text 2 could really be helpful in that situation for an editor without going into the IDE realm. Anyway, see what you like best!
I’ll definitely have a play with Eclipse when I get to that level of complexity. Once again, cheers for the advice