Go to advanced search

by davef21370
Tue Sep 10, 2013 4:58 pm
Forum: Python
Topic: SENDING DATA FROM HTML TO A PYTHON PROGRAM in RPi
Replies: 8
Views: 11672

Re: SENDING DATA FROM HTML TO A PYTHON PROGRAM in RPi

Have a look at this post http://www.raspberrypi.org/phpBB3/viewt ... =32&t=8429, you'll need to dig around in it but there's some good info.

Dave.
by davef21370
Sun Sep 08, 2013 1:58 pm
Forum: Python
Topic: Tkinter help
Replies: 0
Views: 627

Tkinter help

I've been having a dabble with Tkinter and put this together so as to make the exercise worthwhile. It gets information from the /proc directory and displays it in tabs. #!/usr/bin/env python # # Script to get system information from /proc. # Copyrightish Dave Finch 2013. # # Import relevant modules...
by davef21370
Sun Sep 08, 2013 9:46 am
Forum: Python
Topic: How can I read Shift+Tab in curses?
Replies: 3
Views: 2373

Re: How can I read Shift+Tab in curses?

The short answer is you can't. Shift, Ctrl, etc. are just modifier keys, so if the key can't be modified (Tab for instance) they will have no effect.
Sorry.
Dave.

quick edit, PyGame has a function to get the modifiers so may be worth going down that route.
by davef21370
Sat Sep 07, 2013 3:52 pm
Forum: Python
Topic: Reading System Info
Replies: 3
Views: 920

Re: Reading System Info

Cheers Paddy, should be able to get all the required info from that. And thanks Joan, I've noted that little snippet. A little side note; the script works as expected but running from the terminal it really messes up the font, half the characters become unrecognisable. Must be down to printing some ...
by davef21370
Sat Sep 07, 2013 12:59 pm
Forum: Python
Topic: Reading System Info
Replies: 3
Views: 920

Reading System Info

Just trying a little script to get all sorts of system info from the files in /proc. If I manually open the files with nano or similar all the info is there but running the script only returns info from 'uptime' and 'vmstat'. import os os.chdir("/proc") files = [f for f in os.listdir(".") if os.path...
by davef21370
Sat Sep 07, 2013 12:53 pm
Forum: Python
Topic: Python script update via usb stick
Replies: 1
Views: 1488

Re: Python script update via usb stick

by davef21370
Thu Sep 05, 2013 5:59 pm
Forum: Python
Topic: Missing Python File?
Replies: 6
Views: 1638

Re: Missing Python File?

Have a look at the files you've unzipped, is there a "setup.py" file? If so you will need to use "python setup.py build" then "python setup.py install" or something similar.
Not sure without seeing the package.

Dave.
by davef21370
Sun Sep 01, 2013 2:28 pm
Forum: Python
Topic: Control Webpage from GPIO
Replies: 2
Views: 699

Re: Control Webpage from GPIO

I'm assuming you're okay at getting the input through the GPIO, it's just handling the browser part? If so have a look at the webbrowser module http://docs.python.org/2/library/webbrowser.html. Not used it personally but should do what you need.

Dave.
by davef21370
Sun Sep 01, 2013 9:34 am
Forum: Python
Topic: Detect if running on RPi
Replies: 13
Views: 10401

Re: Detect if running on RPi

However, all of these rely on OS commands which, presumably, means they are OS dependent. Is there a Python command or technique that can be used regardless of the presence of a particular OS utility? You could use sys.platform to find out which OS you're running on then use the relevant command fo...
by davef21370
Sun Sep 01, 2013 9:26 am
Forum: Python
Topic: Re: USB RFID door alarm system reed switch problem
Replies: 11
Views: 3093

Re: USB RFID door alarm system reed switch problem

When you're checking the state should it not be GPIO.HIGH and GPIO.LOW instead of just HIGH and LOW? And don't put them in inverted commas, they're numbers, not strings. while True: state = GPIO.input(12) if state == GPIO.HIGH: print "Door Open" elif state == GPIO.LOW: print "Door Closed" time.sleep...
by davef21370
Thu Aug 29, 2013 4:21 pm
Forum: Python
Topic: Python Serial Read
Replies: 3
Views: 26016

Re: Python Serial Read

The indentation is incorrect and you need to use an 'except' after 'try', in this case it will do nothing but it needs to be there... import serial ser = serial.Serial('/dev/ttyACM0', 9600) while True : try:       state=serial.readline()    print(state) except: pass Try that. Dave.
by davef21370
Wed Aug 14, 2013 7:03 pm
Forum: Python
Topic: problem calling a API - curl works, urllib2 doesn't
Replies: 5
Views: 1903

Re: problem calling a API - curl works, urllib2 doesn't

I really don't know, but as your code is okay and it runs on another machine I can only think it's a problem with the OS or settings and as I've used similar code on Debian it isn't an OS problem which only leaves settings.

Dave.
by davef21370
Wed Aug 14, 2013 4:19 pm
Forum: Python
Topic: How to link a py program with Qt GUI
Replies: 2
Views: 2193

Re: How to link a py program with Qt GUI

I may be missing something here but would it not be easier just writing one script with the SMS part in the GUIs main loop?

Dave.
by davef21370
Wed Aug 14, 2013 3:52 pm
Forum: Python
Topic: Change case of specific character in a string
Replies: 4
Views: 1010

Re: Change case of specific character in a string

Maybe try converting the Unicode to ASCII first...
http://stackoverflow.com/questions/1207 ... ra-symbols

Dave.
by davef21370
Tue Aug 13, 2013 5:31 pm
Forum: Python
Topic: Change case of specific character in a string
Replies: 4
Views: 1010

Re: Change case of specific character in a string

Can you not use something simpler like...

Code: Select all

place=sentence.find("#CAPITALISE")
if place != -1:
    place+=11
    sentence[place]=sentence[place].upper
Not tested this but can't be far off and would need some error checking as it assumes there would definately be a character after the hash tag.

Dave.
by davef21370
Mon Aug 12, 2013 4:38 pm
Forum: Python
Topic: Code Help Please?
Replies: 9
Views: 1713

Re: Code Help Please?

Can't really help without seeing your code but that error means you have a character somewhere in the name of a function or variable that isn't a letter, number or underscore so it isn't allowed. It may be a problem with copying and pasting, try downloading the source from the site instead of copyin...
by davef21370
Sun Aug 11, 2013 6:42 pm
Forum: Python
Topic: cgi101.py
Replies: 5
Views: 2225

Re: cgi101.py

Have you tried

Code: Select all

<form method=POST action="python cgi101.py">
May not work but worth a try.

Dave.
by davef21370
Sun Aug 11, 2013 12:05 pm
Forum: Python
Topic: How install opencv?
Replies: 1
Views: 6690

Re: How install opencv?

This worked for me... http://miloq.blogspot.co.uk/2012/12/ins ... linux.html
Give yourself plenty of time, if I remember rightly it took about 4 hours to build and install.

Dave.
by davef21370
Fri Aug 09, 2013 3:45 pm
Forum: Python
Topic: Run a python program on pi startup
Replies: 4
Views: 2021

Re: Run a python program on pi startup

For reasons unbeknown to me, I need to run my python program using a terminal within LXDE, otherwise it doesn't work. I suspect it is something to do with needing a graphic environment for the pygame console. PyGame will run fine from the terminal (and noticeably quicker), no LXDE required. Do you ...
by davef21370
Fri Aug 09, 2013 3:39 pm
Forum: Python
Topic: Visual Basic kind of GUI builder for Python
Replies: 4
Views: 9660

Re: Visual Basic kind of GUI builder for Python

I'll agree with Davespice about VB covering up some important stuff, I used REALBasic (very similar package) on the Mac years ago and it's fine for throwing something together quickly but you miss how everything works. Personally for a GUI in Python I'd use PyQT with QT Designer to create the interf...
by davef21370
Fri Aug 09, 2013 1:18 pm
Forum: Python
Topic: Import PyGame in Python 3.3.2
Replies: 2
Views: 1202

Re: Import PyGame in Python 3.3.2

Unfortunately not, PyGame doesn't work with Python 3.

Dave.
by davef21370
Thu Aug 08, 2013 5:18 pm
Forum: Python
Topic: i2C commands in Python
Replies: 1
Views: 1234

Re: i2C commands in Python

You're best bet would be to post this question in the "Hardware and peripherals - Interfacing (DSI, CSI, I2C, etc.)" forum. I know it's a Python related question but it's kind of specialized so you'll probably have more luck there.

Cheers.
Dave.

Go to advanced search