xtramural
Posts: 108
Joined: Thu Dec 29, 2011 11:16 pm
Location: Scotland

Re: WiringPython - WiringPi for Python

Tue Aug 14, 2012 12:41 pm

If you're wanting to use Wiring Pi then you need to install it (rather than, or in addition to, python-rpi.gpio_0.3.1a-1_armhf.deb). See Raspberry Pi | Wiring | Download & Install | Gordons Projects for details.

texy
Forum Moderator
Forum Moderator
Posts: 5155
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: WiringPython - WiringPi for Python

Tue Aug 14, 2012 1:07 pm

As yes, I missed that!

More specifically, to install for python, use

Code: Select all

git clone https://github.com/WiringPi/WiringPi-Python.git
For installation and info, see

Code: Select all

https://github.com/WiringPi/WiringPi-Python
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

User avatar
Grumpy Mike
Posts: 909
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)
Contact: Website

Re: WiringPython - WiringPi for Python

Sun Aug 19, 2012 1:46 pm

I found this great introduction about installing WiringPi:-
http://blogs.foomatic.org/blink-away-the-tears/
Sadly it doesn't work.
First off because the setup.py build is asking for a file called wiringSerial.h and there isn't one. Sure there is a serial.h, so I substituted all the files in Gordon's latest download into the wiringPi folder.
However then it complains that
WiringPi/__init__.py is not found.
Stumped at this point. It looks like WiringPi for Python is not up to date with Gordon's code despite WiringPi for Python only having been updated yesterday.
Any idea how to proceed?

texy
Forum Moderator
Forum Moderator
Posts: 5155
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: WiringPython - WiringPi for Python

Sun Aug 19, 2012 2:08 pm

Yes Mike, installation appears to be screwed using the 'readme' instructions as I found out yesterday. My SD decided it wasnt going to boot anymore, but luckily I had a backup of the wiringpi files and my gpio python files on my laptop. I was unable to install from the net using the instructions with the same missing file error you mentioned, but I was able to install from a previous download I had in my backup.
Hopefully gadgetoid will be able to pick up on this, otherwise a PM may be in order.

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

gadgetoid
Posts: 152
Joined: Wed Mar 07, 2012 9:58 pm

Re: WiringPython - WiringPi for Python

Tue Aug 21, 2012 11:50 am

wiringSerial.h should be available in the latest WiringPi changes on GitHub, and should be pulled down with the submodule.

If you:

Code: Select all

cd WiringPi/wiringPi
git pull origin master
You should get the latest files. I'm not familiar enough with git to know why on earth it doesn't get them when you do "git submodule update --init"

Just done a git push which should, hopefully, make it work! ( mostly )


Note: I still get the following error, but it's not fatal:

package init file 'WiringPi/__init__.py' not found (or not a regular file)


P.S. I'm eager for help/contributions on the python front. I am in the process of getting it PyPI ready, but it's all untread ground for me.

xtramural
Posts: 108
Joined: Thu Dec 29, 2011 11:16 pm
Location: Scotland

Re: WiringPython - WiringPi for Python

Tue Aug 21, 2012 12:14 pm

Just tried to update and received the following error:

Code: Select all

[email protected] ~/WiringPi-Python/WiringPi/wiringPi $ git pull origin master
fatal: https://github.com/Gadgetoid/WiringPi.git/info/refs not found: did you run git update-server-info on the server?

User avatar
Grumpy Mike
Posts: 909
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)
Contact: Website

Re: WiringPython - WiringPi for Python

Tue Aug 21, 2012 12:41 pm

gadgetoid wrote:If you:

Code: Select all

cd WiringPi/wiringPi
git pull origin master
You should get the latest files. I'm not familiar enough with git to know why on earth it doesn't get them when you do "git submodule update --init"
When I do that and try the python setup.py build I get WiringPi/wiringPi/serial.c - no such file
and a 'gcc' fatal error message.

By adding Gordons files directly into the wiringPi folder I did get it to build yesterday and could import it to Python but none of the commands worked.

So basically I think the setup.py is asking for the wrong files. But then I am more of a beginner at this than you. :)

dimonic
Posts: 41
Joined: Fri Jun 08, 2012 9:08 pm

Re: WiringPython - WiringPi for Python

Tue Aug 21, 2012 1:20 pm

Hartspoon wrote: Plus, there is a stand-alone version of WiringPi that allows you to control GPIO as a normal user! So the wiki is apparently wrong about that point, or at least missing something.
I believe the stand-alone gpio program runs set-uid (I am not in front of my Pi at the moment).

User avatar
Grumpy Mike
Posts: 909
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)
Contact: Website

Re: WiringPython - WiringPi for Python

Tue Aug 21, 2012 4:33 pm

I have found that if after the:-
git pull origin master
I then go and make a copy of the file wiringSerial.c and call it serial.c
I can then go through all the steps at http://blogs.foomatic.org/blink-away-the-tears/
Successfully, until the end, step 5 testing.
gpio commands issued from the command line don't appear to do anything and an
import wiringpi
in a python script will give me a :-
"No module named wiringpi" error message.

dimonic
Posts: 41
Joined: Fri Jun 08, 2012 9:08 pm

Re: WiringPython - WiringPi for Python

Tue Aug 21, 2012 5:15 pm

Grumpy Mike wrote:gpio commands issued from the command line don't appear to do anything
The gpio command (like most unix utilities) does not output anything to the console (generally). It usually just does what you tell it to do (control gpio pins). I assume you have attached something (like an LED) to actually determine if it is working as advertised?

User avatar
Grumpy Mike
Posts: 909
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)
Contact: Website

Re: WiringPython - WiringPi for Python

Tue Aug 21, 2012 5:41 pm

dimonic wrote:I assume you have attached something (like an LED) to actually determine if it is working as advertised?
Yes I looked at them with a scope.

dimonic
Posts: 41
Joined: Fri Jun 08, 2012 9:08 pm

Re: WiringPython - WiringPi for Python

Tue Aug 21, 2012 5:50 pm

Grumpy Mike wrote:
dimonic wrote:I assume you have attached something (like an LED) to actually determine if it is working as advertised?
Yes I looked at them with a scope.
Cool - I know WiringPi by itself (and gpio) were working as of 15th Aug (I installed them on stock Raspbian) and I ran a blinking LED script in the shell.

User avatar
Grumpy Mike
Posts: 909
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)
Contact: Website

Re: WiringPython - WiringPi for Python

Tue Aug 21, 2012 5:59 pm

Yes I am using Wiring Pi in C but I need to be able to produce stuff in Python.

gadgetoid
Posts: 152
Joined: Wed Mar 07, 2012 9:58 pm

Re: WiringPython - WiringPi for Python

Wed Aug 22, 2012 9:33 am

Looks like I'm going to have to build and test this myself.

I can certainly "import wiringpi" and access it.

You might want to ditch your local files and grab the repo again, as I'm not sure what git commands would get it into the right state- I just know that a fresh grab and init results in a buildable version which appears to work for me.

I'll hook up my LCD and run my test.py when I get home, to see if it's not just making things up!

Don't forget to set your GPIO modes correctly, too! And also be careful about which pin numbering system you use, that can cause confusion abound.

texy
Forum Moderator
Forum Moderator
Posts: 5155
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: WiringPython - WiringPi for Python

Wed Aug 22, 2012 10:20 am

I think new full instructions for a clean raspbian os are required - there are new users finally getting pi's deliveries all the time.
Just a thought - keep up the good work ;)
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

gadgetoid
Posts: 152
Joined: Wed Mar 07, 2012 9:58 pm

Re: WiringPython - WiringPi for Python

Wed Aug 22, 2012 10:56 am

texy wrote:I think new full instructions for a clean raspbian os are required - there are new users finally getting pi's deliveries all the time.
Just a thought - keep up the good work ;)
Texy
You're right! I'm loathe to reboot my Pi, though, the uptime is awesome! But I don't think I can wait any longer for my second testing Pi.

I'm aware I've got to check all this out in Raspbian and any other popular distributions, I was considering some sort of continuous integration setup, too, but that may be a little overkill.

User avatar
Grumpy Mike
Posts: 909
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)
Contact: Website

Re: WiringPython - WiringPi for Python

Wed Aug 22, 2012 11:19 am

gadgetoid wrote:You might want to ditch your local files and grab the repo again, as I'm not sure what git commands would get it into the right state.
That is what I did yesterday. I deleted all the files and went with the instructions on http://blogs.foomatic.org/blink-away-the-tears/ Have you checked this to see that it is telling me correctly how to install this?

That is when it could not find serial.c. I did notice when I did git 'pull origin master' I got a message saying that it had rename serial.c wiringSerial.c, that is why I made a copy of the file under the original name.
I'm aware I've got to check all this out in Raspbian
That is what I am using so it might be the problem. :(

Thanks

gadgetoid
Posts: 152
Joined: Wed Mar 07, 2012 9:58 pm

Re: WiringPython - WiringPi for Python

Wed Aug 22, 2012 4:40 pm

Some of the new changes from Gordon have broken the wrapper. I didn't notice this before, sorry!

Now working on a solution, but running into undefined symbol errors that I should not be running into!

gadgetoid
Posts: 152
Joined: Wed Mar 07, 2012 9:58 pm

Re: WiringPython - WiringPi for Python

Wed Aug 22, 2012 8:12 pm

I committed some more fixes to the repository and followed the instructions posted to the letter on Debian Squeeze ( not Raspbian ).

Everything seems to be working! I can digitalRead, although I have yet to try a write- I'll hopefully manage to do that after food.

I will try a build test on Raspbian as soon as I can. Right now, though, I'm starving!

There's also now a new PHP wrapper and major fixes to the Ruby version.

dimonic
Posts: 41
Joined: Fri Jun 08, 2012 9:08 pm

Re: WiringPython - WiringPi for Python

Wed Aug 22, 2012 8:39 pm

Awseom. Eat . Eat healthy food. Live long and prosper, so we can benefit from your happy coding!

Saulverde
Posts: 15
Joined: Fri Aug 17, 2012 12:18 am

Re: WiringPython - WiringPi for Python

Thu Aug 23, 2012 11:08 pm

For Raspbian (wheezy) I used the instructions on this site. http://www.sirmc.net/view/9001/

There was one error

Code: Select all

package init file 'WiringPi/__init__.py' not found (or not a regular file)
It was not a fatal error, the installation appeared to complete successfully. That said I have no means to actually test the pins. I am going to pick up some LED's and resistors this weekend.

I Just thought it would be a good place to start for some of you guys looking for raspbian install instructions.

texy
Forum Moderator
Forum Moderator
Posts: 5155
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: WiringPython - WiringPi for Python

Fri Aug 24, 2012 6:15 am

The instructions should come with the package. We shouldn't have to scour the internet to find a random blog with there experiences.
I,m sure Gadgetoid will have it covered ;)

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

User avatar
Grumpy Mike
Posts: 909
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)
Contact: Website

Re: WiringPython - WiringPi for Python

Fri Aug 24, 2012 8:27 am

Saulverde wrote:For Raspbian (wheezy) I used the instructions on this site. http://www.sirmc.net/view/9001/

There was one error

Code: Select all

package init file 'WiringPi/__init__.py' not found (or not a regular file)
It was not a fatal error, the installation appeared to complete successfully. That said I have no means to actually test the pins. I am going to pick up some LED's and resistors this weekend.

I Just thought it would be a good place to start for some of you guys looking for raspbian install instructions.
Being new to Linux I am constantly amazed at the attitude to error messages that Linux users have. The "well you can safely ignore that one" attitude. How on earth do you know?
That web site did not cover the changing of the make file that the one I was following did. Anyway I "successfully" completed all the steps on a Raspbian distro but when I came to do the import into Python it said there was no such module.
Which is further than I got trying to install it yesterday on the Debian Squeeze distro. Here it stopped on the setup.py build stage and said that setuptools was missing, it never did that before the latest change.

Despite not sounding so, I am very much indebted to Gadgetoid for his work so far, thanks for your efforts and I am sure you are nearly there.
Last edited by Grumpy Mike on Fri Aug 24, 2012 8:49 am, edited 1 time in total.

BlackJack
Posts: 288
Joined: Sat Aug 04, 2012 8:28 am
Contact: Website

Re: WiringPython - WiringPi for Python

Fri Aug 24, 2012 8:48 am

@Grumpy Mike: I don't think ignoring errors is or should be a typical Linux user reaction.

In this case fixing the error might be a good idea. As it seems the ``setup.py`` contains an error as it says there is a package `WiringPi`. But there is no such package.

Code: Select all

while not self.asleep():
    sheep += 1

User avatar
Grumpy Mike
Posts: 909
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)
Contact: Website

Re: WiringPython - WiringPi for Python

Fri Aug 24, 2012 10:22 am

BlackJack wrote:@Grumpy Mike: I don't think ignoring errors is or should be a typical Linux user reaction.
I agree it should not be but in my experience it is. I just googled:-
Linux "ignore the error"
and got 567,000 hits!

Return to “Python”