Go to advanced search

by paddyg
Mon Sep 09, 2013 1:17 pm
Forum: Python
Topic: Task priority / niceness in python
Replies: 6
Views: 4425

Re: Task priority / niceness in python

I've not done it but I'm pretty sure it can. You might be able to just import the packages as usual, at worst you may have to dress it up a little. Here's a project using GPIO with cython It's probably worth splitting the jobs into different threads or using some of the callback systems if those are...
by paddyg
Mon Sep 09, 2013 11:46 am
Forum: Python
Topic: pi3d still moving onwards and upwards
Replies: 10
Views: 2626

Re: pi3d still moving onwards and upwards

temp1.jpg
temp1.jpg (28.7 KiB) Viewed 2017 times

Same thing but using mpg321 to modify shader in real time. Struggling on this video with X eating all the cpu but fine without (like this). @lecloneur is promising lots of new filters!
by paddyg
Mon Sep 09, 2013 11:35 am
Forum: Python
Topic: Task priority / niceness in python
Replies: 6
Views: 4425

Re: Task priority / niceness in python

Once you've got the profile data (I know you were digging into this) you could hive off the offending code into functions that you can compile with Cython . I've used this on the raspberry pi and it's remarkably easy to do (certainly compared with writing you own module in C). The biggest benefit co...
by paddyg
Sun Sep 08, 2013 6:11 pm
Forum: Gaming
Topic: pi3d
Replies: 21
Views: 4255

Re: pi3d

Well writing a game is **hard**, typically it will take a team of experienced programmers and graphic artists thousands of hours and they will utilise vast amounts of pre-written material. For a good 3D game the majority of the programmers will have a good grasp of trigonometry, vectors and matrices...
by paddyg
Sun Sep 08, 2013 8:37 am
Forum: Gaming
Topic: pi3d
Replies: 21
Views: 4255

Re: pi3d

Any reasonable feature request considered. If submitted on paper in triplicate and duly endorsed by five stalwart citizens (ideally senators but senior partners of sufficiently large firms of attorneys may do)
by paddyg
Sat Sep 07, 2013 11:37 pm
Forum: Gaming
Topic: pi3d
Replies: 21
Views: 4255

Re: pi3d

Jim, good to hear that pifinity is still progressing. I'm very much looking forward to seeing it.

If there's anything I can contribute (beyond getting pi3d stable and capable) let me know.

Paddy
by paddyg
Sat Sep 07, 2013 2:45 pm
Forum: Gaming
Topic: pi3d
Replies: 21
Views: 4255

Re: pi3d

We've recently changed things a bit (a lot relative to that last link) The demos are all in a different place from the raw package now. I would suggest looking here , to see about downloading and installing. Unless you want to hack the pi3d source I would suggest using one of the first two 'install'...
by paddyg
Sat Sep 07, 2013 2:25 pm
Forum: Python
Topic: Reading System Info
Replies: 3
Views: 920

Re: Reading System Info

Dave, I really don't know but here's a handy way of getting python to do 'anything' you can do in a terminal! import os, subprocess def _run_command(command): p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) return iter(p.stdout.readline, b'') os.chdir("/proc") files =...
by paddyg
Fri Sep 06, 2013 7:09 am
Forum: Python
Topic: If Statments
Replies: 1
Views: 495

Re: If Statments

If you want your python program to do other things while it's watching out for a key press then it's surprisingly non-trivial. The easiest way is probably to use curses though there are various annoying things that go along with it import curses stdscr = curses.initscr() stdscr.nodelay(1) # doesn't ...
by paddyg
Fri Sep 06, 2013 6:41 am
Forum: Python
Topic: Pyaudio in Python 3
Replies: 6
Views: 10566

Re: Pyaudio in Python 3

Sorry, as I said, I had already installed python3-dev and git so didn't actually run those lines. Obviously what I should have typed was

Code: Select all

sudo apt-get install python3-dev
at least now you will recognise the error apt-get sends you when you forget to type install!!
by paddyg
Thu Sep 05, 2013 11:11 pm
Forum: Python
Topic: pi3d still moving onwards and upwards
Replies: 10
Views: 2626

Re: pi3d still moving onwards and upwards

Finally pushed into doing something about rendering to texture for post processing like this temp.jpg http://youtu.be/yBMjVzKgPZU PS if you want the code for this from github I have put the demos in a different place. And you need to get these latest things from the develop branches in github.com/ti...
by paddyg
Thu Sep 05, 2013 7:17 am
Forum: Python
Topic: Pyaudio in Python 3
Replies: 6
Views: 10566

Re: Pyaudio in Python 3

Hi, just tried this and it works ok, so my comments are not now pure guesswork! I did basically as I said in my last comment i.e. change the 'python setup.py install' to 'python3 setup.py install' this puts the pyaudio files into /usr/local/lib/python3.2/dist-packages/ which is where python3 looks f...
by paddyg
Wed Sep 04, 2013 5:16 pm
Forum: Python
Topic: Pyaudio in Python 3
Replies: 6
Views: 10566

Re: Pyaudio in Python 3

How did you install pyaudio? Was it following the procedure here (debian) which seems to only have distributions for x86 machines or with 'sudo apt-get install python-pyaudio'? There look to be python2 and python3 packages, does your app work ok with python2? You might have to do something as outlin...
by paddyg
Tue Sep 03, 2013 6:07 pm
Forum: Python
Topic: Detect if running on RPi
Replies: 13
Views: 10401

Re: Detect if running on RPi

don't hack it, use platform as @davef says. It's platform independent python.

in pi3d we decided it was actually more relevant to know what shared libraries were available rather than the actual machine or operating system. We do this with ctypes.util.find_library() which seems to work well.
by paddyg
Fri Aug 30, 2013 9:50 pm
Forum: User groups and events
Topic: North Yorkshire
Replies: 2
Views: 1033

Re: North Yorkshire

I'm in Bingley. Mainly working on the pi3d module but also a bit of GPIO in and out. Happy to link up.
by paddyg
Fri Aug 30, 2013 9:37 pm
Forum: Python
Topic: Python Performance Profiling
Replies: 7
Views: 2215

Re: Python Performance Profiling

@robbes, those look like really useful tools. On the issue of memory leak tracking I found this code to be really helpful and quite simple to wrap round potentially leaky code:
by paddyg
Thu Aug 29, 2013 6:49 pm
Forum: Python
Topic: Python Performance Profiling
Replies: 7
Views: 2215

Re: Python Performance Profiling

Yes, I noticed I had written python3 after I posted. I just copied and pasted from a post on the pi3d google groups where I was talking about trying to track down why python3 seemed to do one particular thing (reading from /dev/input/) badly c.f. python2. Obviously for that particular exercise it wa...
by paddyg
Thu Aug 29, 2013 5:18 pm
Forum: Python
Topic: Python Performance Profiling
Replies: 7
Views: 2215

Re: Python Performance Profiling

It's not too hard to do profiling in python. What I have done is run the program like this python3 -m cProfile myapp.py > temp3_01.txt then paste the results into a spreadsheet to sort by number of calls or total time etc. If you run the program for the same length of time each time you do it you ca...
by paddyg
Mon Aug 26, 2013 6:02 pm
Forum: Python
Topic: Asyncronous call to RPi.GPIO
Replies: 3
Views: 1038

Re: Asyncronous call to RPi.GPIO

yes, that's right. If timing was critical then you would have to utilise a different thread. In python that's not the end of the world (in terms of complexity) but better to work up to that if you find you need to.
by paddyg
Mon Aug 26, 2013 4:55 pm
Forum: Python
Topic: Asyncronous call to RPi.GPIO
Replies: 3
Views: 1038

Re: Asyncronous call to RPi.GPIO

you could use something like while true: tmnow = time.time() if on_time > 0 and tmnow > (on_time + 0.1): # use a variable duration really GPIO.output(12, GPIO.LOW) on_time = -1 # something switches the light on, could be a timer as for switching it off if switch_on(): GPIO.output(12, GPIO.HIGH) on_t...
by paddyg
Sun Aug 25, 2013 8:14 pm
Forum: Python
Topic: detecting keystrokes?
Replies: 3
Views: 1455

Re: detecting keystrokes?

Presumably you want to be able to press a key and something happen, and not have the program stop waiting for a key input, and not have to press the enter key afterwards as well. This is a surprisingly difficult and commonly required thing for python to do. In pi3d we either use curses or low level ...
by paddyg
Sat Aug 24, 2013 9:28 pm
Forum: Python
Topic: how take data string from serial and write into file
Replies: 11
Views: 6947

Re: how take data string from serial and write into file

you have to use file seek to write characters part way along an already written file. Was that what you were asking?
by paddyg
Sat Aug 24, 2013 3:30 pm
Forum: Python
Topic: Odd counter behaviour with Python and GPIO
Replies: 11
Views: 3430

Re: Odd counter behaviour with Python and GPIO

hmm, that doesn't look entirely logical to me if the package is imported 'as gpio'

I did something with GPIO following the example here and it seemed to work. The callback function is passed as a keyword argument in GPIO.add_event_detect and GPIO.add_event_callback isn't used
by paddyg
Sat Aug 24, 2013 7:37 am
Forum: Python
Topic: Odd counter behaviour with Python and GPIO
Replies: 11
Views: 3430

Re: Odd counter behaviour with Python and GPIO

gpio.RISING?
by paddyg
Fri Aug 23, 2013 8:32 pm
Forum: Python
Topic: pi3d: paths and importing pi3d module for program
Replies: 14
Views: 3056

Re: pi3d: paths and importing pi3d module for program

Tom, brilliant. That's solved it. But ironically I also find I can undo the two changes that I thought were making the difference!! i.e. inserting at 0 and deleting the top __init__ and it still works. The critical thing was in your comments about looking for textures, models etc. I created /home/an...

Go to advanced search