brew install pyside --with-python3
brew install pyqt --with-python3
brew linkapps

Hopefully this should install PySide for both Python 3 and 2.7. PyQt will also be installed for 3 and 2.7.

The dependencies will also be installed, i.e. SIP, Shiboken, Qt etc.

brew linkapps will just symbolically link the apps installed with Qt (the designer etc. that will come in handy later), to your Applications folder, which is practical for access.

Virtual environments (or virtualenv’s) are one of the things I didn’t really understand why or how I should use them. Although it’s relatively simple to figure out, you’ll have to jump from page to page to get a simple and clear understanding of what they actually do. I hope I can summarise the basic concept and benefits of using them here.

First thing: when developing with Python, almost always use virtual environments. 

Why? A virtual environment is a way of getting you to keep one project to itself. You may need to install packages for your project, and the same for another. But what if the packages you need require different versions? And what if you install them to your site-package directory, and then you lose functionality in one project, but gain it in another? This kind of complex situation can simply be dealt with by using virtual environments.

The virtual environment will simply install packages into a special directory, just for your project. This way you can avoid conflicts between projects and their requirements’ versions. It just makes everything a whole lot easier.

Second thing: it’s worth the fuss.

Yes, creating and using virtual environments can be quite a fuss, and knowing how to use things like Git with them can be too. But it will save you time later, and help you keep things organised. Keeping everything installed locally also means you can go into packages and their files, modify some of their code fit to your project’s needs, without having to worry about any other scripts that rely on them.

Thirdly: how to actually do it.

Virtualenv is a package that you can install with pip. So it’s no big deal getting it up and started. I don’t want to waste time explaining how to install it all and use it, since someone’s already done it better than I could. Look at the guide here. However if you are just looking for that one line of code to install it, here it is:

pip install virtualenv

If you need, to then you can always use sudo to install it into the site-packages (but you won’t have to when using a virtual environment!).

When you read the guide I linked you to, you’ll notice how it’s a bit fussy to activate everything. Scroll down a bit further on that page and look at virtualenvwrapper, since it’s another great package that makes projects and little projects so much easier to use.

If you do choose to use this wrapper, you’ll find that after a week, you won’t even know that you’re always using a virtualenv

Extra notes: using Git.

I like developing things with Django at the moment, and virtual environments are the only way to go with this. When I need to install packages in the local, virtual environment, then it’s simple and organised (I often have multiple projects going at one time). But I’m getting to the point where I want to keep my code on GitHub, so that I can work on the project with friends, all with the help of version control. However I can’t upload all my required packages, and I can’t remember them all either.

Luckily, there’s a great way to help out your co-coders. It’s quite simple, but there’s more detail here. To summarise, you use the pip freeze command, which will give you a list of all dependencies, put that into a text file called requirements.txt (or whatever you want to call it), and get all others working on the project, to start their virtual environments, copy the files in, and install the required packages with

pip install -r requirements.txt

It’s really that simple. Jason, here, goes into more detail about you .gitignore, etc. so I really recommend reading his article if you plan to use Git at all with Python, or more specifically, Django.

I’m writing another short post on how to get yourself up and running with a Git-based project, so that you can get co-developing as soon as possible.

Virtual environments do it all, and easily. Just get used to using them and you’ll save time in the long run, on more complicated projects!

FFmpeg is an all in one solution to audio/video conversion, all from the command line. So clearly it’s a great tool to use on the Raspberry Pi, since working on the command line is practical in most scenarios.

Installing it onto Raspbian is as simple as installing it onto any Debian operating system.

Simply edit your /etc/apt/sources.list with nano:

nano /etc/apt/sources.list 

Add the line:

deb http://www.deb-multimedia.org wheezy main

You may get a warning about the packages not being authenticated, but just agree to installing them, and carry on. There’s nothing nasty in the packages.

This should let you use the install from the Debian Multimedia package list. But before you can, you obviously need to update your package lists with:

sudo apt-get update

You will also have to install the ‘deb-multimedia-keyring’, which will get you access to install the FFmpeg package from their directory. Also update again after you’ve done so.

sudo apt-get install deb-multimedia-keyring

Of course your final line will be installing FFmpeg! It’s as simple as:

sudo apt-get install ffmpeg

(Remember to agree to the install, after Do you want to continue [Y/n]?)

Hope this helps!

I’ve spent the last few hours trying to get Google Translate’s Text-To-Speech engine to be nice with me, and give me an audio file when I ask for it through Python-Requests, or urllib2.request().

By playing around with the headers and parameters, you can get avoid the anti-abuse CAPTCHA that Google have put over their engine. This is the simple set.

For some reason, a collection of (really) unnecessary parameters can shift you right past the CAPTCHA, providing you have the right headers in you GET request. An example of this is:

https://translate.google.com/translate_tts?ie=UTF-8&q=no%20captcha%20here&tl=en&total=1&idx=0&textlen=5&tk=131396&client=t

By looking at the headers sent in the request, we see user-agent with a valid User-Agent, as expected. This is really, the important header (but so is referrer as you will later see)

Opening this page is easy with the correct headers. But downloading the file?

Read the rest of this entry »

Can you do simple text to speech with a Raspberry Pi? And can you do it for free?
Yes!

Using the pyttsx package for Python, you can simulate speech easily and for free.

Read the rest of this entry »

When you first step into the world of programming, you’ll want to impress. Impressing people with coded solutions is very satisfying, and often the main objective in many products. But once you’ve started learning, you’ll come to find the sad truth about programming in general. Most of the time, what you’re doing will be unimpressive to outsiders. This is one of the obstacles that you’ll have to drive through when you begin learning, and learn that it will never change. You can, however, learn to love this stage in its entirety. I did it – so can you.

Read the rest of this entry »

Getting new things is always satisfying, but whether they’re good purchases or not… can vary. Free things are almost always better, so you can thank the computing community heavily, for their push on free and almost-free software and resources. Using the resources effectively is vital to being efficient. So I’ve selected the most used applications and services that I use when programming, to transform you into the programmer you are at heart. Having the kit is part of the lifestyle.

Read the rest of this entry »

Between the idea of a project and its production, I came across one problem: I didn’t know where to start, so I didn’t how to do it. That’s how it goes, sadly. Knowing what to look for, and where to find it are the main stages towards finishing a product. I’ll supply you with a few links to make sure that you’re set off in the right direction. Luckily for you, now is the time to start using hardware like the Raspberry Pi; the communities are established and the ideas have spread. You won’t have my problem of trying to find learning resources in the barren wasteland that came with learning to code on a Pi. Although this generally applies to those who are starting Raspberry-Pi-ing, the details are applicable to most languages

Read the rest of this entry »

Raspberry Pi seems like the ultimate part of a beginner-computer-scientist kit. But actually understanding how to use it to learn to code is still unclear. Great for projects, illustrated by the thousands of instuctables and hundreds of articles from Make Magazine, but I always found the learning part a bit confusing. In the noise that surrounded Raspberry Pi when it first came out, the idea of using it as a learning platform for programming got slightly lost. The dust built on the idea and there was a lack of innovation for a while.

I remember unboxing the Raspberry Pi, from its anti-static bag, amazed that it was really a tiny computer. After flashing the SD card, and setting it all up I was lost. What could I do with it? I was 14 at the time, and the Pi had only begun to start being adopted by the middle-aged programmers of Britain. It wasn’t the vibrant scene I expected.

Read the rest of this entry »

Learning  online is simple, easy and often free, thanks to the likes of CodeAcademy and Khan Academy. Personally, I learnt the basics of Python from CodeAcademy, the course is broken down nicely, despite only doing about 7% of it, I got it.

Writing online coding courses is really an art, and navigating your way through the ones that work for you and the ones that don’t, is a challenge at best. It’s difficult to give recommendations on the good courses and what to avoid, since each language is taught best somewhere, and each person has their preference when it comes to learning something. JavaScript and Python were the two languages that I recommended for beginners; conveniently, they’re both taught across a range of websites, but finding the one of hundreds of teaching sites that fits your learning niche is the real task.
Read the rest of this entry »

Create your own website, free on WordPress.com.Create your own website.
Start free