Go to advanced search

by tom.slick
Thu Sep 22, 2016 6:21 am
Forum: Python
Topic: Drawing with Python
Replies: 9
Views: 2521

Re: Drawing with Python

dunno why people are so fixed on using Python 3 when it's not really complete or compatible. It's like Perl 6 was a decade ago … I have noticed the same thing here. Everyone is stuck on Python 3 as the latest and greatest. I think it has to do with Windows. Version numbers seem to mean more then st...
by tom.slick
Tue Sep 20, 2016 9:07 pm
Forum: Python
Topic: Two variables, same value, diferent behaviour
Replies: 3
Views: 638

Re: Two variables, same value, diferent behaviour

And 0x83339999 = 2201196953 not 2201590169
by tom.slick
Tue Sep 20, 2016 9:05 pm
Forum: Python
Topic: Two variables, same value, diferent behaviour
Replies: 3
Views: 638

Re: Two variables, same value, diferent behaviour

Your passing a string to the bin function.
It requires an int

Code: Select all

bits = bin(int(HT_hex, 16))[2:]
by tom.slick
Mon Sep 12, 2016 8:19 pm
Forum: Python
Topic: Sun up in the sky?
Replies: 11
Views: 2606

Re: Sun up in the sky?

Altitude will get you close. Look at the example on the pysolar page https://pysolar.readthedocs.io/en/latest/ Get the Suns altitude for your location now and compare it to the starting altitude. example from pysolar.solar import * import datetime import time months = [0, 31, 28, 31, 30, 31, 30, 31,...
by tom.slick
Fri Sep 09, 2016 10:55 pm
Forum: Python
Topic: Learning Python
Replies: 18
Views: 2908

Re: Learning Python

But do you get the same capabilities in the same way under Windows as a unix like OS? For the most part yes it's the same capabilities in the same way under Windows. The only big differences are the nix only or windows only modules. For the built-in modules most of them have equivalent versions of ...
by tom.slick
Wed Sep 07, 2016 4:49 am
Forum: Python
Topic: Learning Python
Replies: 18
Views: 2908

Re: Learning Python

So it's easier to install virtual machine software, install a flavor of linux and configure it or install and configure linux to run from a usb stick, then it is to point and click on the python installer ???????????????????????????????????????????????????????????????
by tom.slick
Mon Sep 05, 2016 7:55 pm
Forum: Python
Topic: method dynamic invocation
Replies: 2
Views: 550

Re: method dynamic invocation

It would be easy to put a reference to the function in the array def function1(): print "this was function 1" def function2(): print "this was function 2" def function3(): print "this was function 3" def function4(): print "this was function 4" function_list = [function1, function2, function3, funct...
by tom.slick
Sun Sep 04, 2016 6:56 pm
Forum: Python
Topic: GPIO inputs from a list?
Replies: 5
Views: 2213

Re: GPIO inputs from a list?

If the index of the switch is the same as the index of the relay then use a for loop on the indices import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) #GPIO BCM pins in use relays = [2, 3, 4, 17] sws = [18, 23, 24, 25] def setup(): for x in range(len(relays)): GPIO.setup(relays[x], GPIO.OUT)...
by tom.slick
Sat Sep 03, 2016 11:21 pm
Forum: Python
Topic: Bytearray issue
Replies: 2
Views: 696

Re: Bytearray issue

Code: Select all

def my_array(databytes=(0x00, 0x00, 0x00), crc=0x00):
    start=0x96
    address=0xbe
    lenbytes=0x83
    stop=0xa9
    data = bytearray([start, address, lenbytes, 0, 0, 0, crc, stop])
    data[3:6] = databytes
    return data

my_array(databytes=(0xba,0xf1,0xba), crc=0x33)
by tom.slick
Wed Aug 31, 2016 3:55 pm
Forum: Python
Topic: Seven Segment Remove Decimal Problem
Replies: 2
Views: 904

Re: Seven Segment Remove Decimal Problem

Your using print_number_float so it is going to print a decimal.
Try print_number_str

Code: Select all

display.print_number_str(str(count))
by tom.slick
Wed Aug 31, 2016 3:40 pm
Forum: Python
Topic: problem installing lunatic python
Replies: 8
Views: 1743

Re: problem installing lunatic python

has anyone running lunatic python on his or her raspberry pi ? 2.7/src/pythoninlua.o -I /usr/include/lua5.2 src/pythoninlua.c:28:17: fatal error: lua.h: No such file or directory You need to install the dev files for lua5.2 sudo apt-get install lua5.2 liblua5.2-dev ive noticed that :) and changed i...
by tom.slick
Wed Aug 31, 2016 12:51 pm
Forum: Python
Topic: problem installing lunatic python
Replies: 8
Views: 1743

Re: problem installing lunatic python

deejay_d wrote:has anyone running lunatic python on his or her raspberry pi ?
2.7/src/pythoninlua.o -I/usr/include/lua5.2
src/pythoninlua.c:28:17: fatal error: lua.h: No such file or directory

You need to install the dev files for lua5.2
sudo apt-get install lua5.2 liblua5.2-dev
by tom.slick
Tue Aug 16, 2016 2:51 am
Forum: Python
Topic: Help with a simple program
Replies: 4
Views: 1024

Re: Help with a simple program

simple answer store_names = ["Boyne General Store", "store2", "store3", "store4", "store5"] paper_names = ["NYT", "WSJ", "USAT", "FP", "DTN"] stores = {store: dict() for store in store_names} def func(store_name): print("\n..." + store_name + "...") for paper in paper_names: while True: try: stores[...
by tom.slick
Sat Aug 13, 2016 11:32 pm
Forum: Python
Topic: unable to install python-dev
Replies: 10
Views: 4592

Re: unable to install python-dev

foster82 wrote:There was a mistake with one of the entries that wasn't correct. It was a copy and paste fail.
You still have a fail. 2.7.3-6+deb7u3 is a Wheezy package, and 2.7.9-2 is Jessie.
by tom.slick
Wed Aug 10, 2016 11:50 pm
Forum: Python
Topic: pocketsphinx python error
Replies: 26
Views: 4424

Re: pocketsphinx python error

if you look at the source for pocketsphinx the structure of the model folder is model/ model/en-us model/cmudict-en-us.dict model/en-us-phone.lm.bin model/en-us.lm.bin so if you are using the folder structure from the source then it should be config.set_string('-hmm', path.join(MODELDIR, 'en-us')) c...
by tom.slick
Wed Aug 10, 2016 7:50 am
Forum: Python
Topic: pocketsphinx python error
Replies: 26
Views: 4424

Re: pocketsphinx python error

Looks very similar to http://stackoverflow.com/questions/35773734/missing-acoustic-model-definition-mdef-with-pocketsphinx-python Probably not directly related to running it on an RPi. Thanks for the reply. But there is somone that use pocketsphinx on the raspberry pi here is the link http://www.in...
by tom.slick
Wed Aug 10, 2016 7:36 am
Forum: Python
Topic: Print Statement "locate"
Replies: 2
Views: 508

Re: Print Statement "locate"

I've been google-ing for >5.5 hours and have learned lots of stuff, but not what I want. Must be searching on the wrong key words. I want to be able to quickly / easily locate the place where I print on the screen. Like basic's "locate(x,y)" statement. Is there such a thing in python? Thanks. That ...
by tom.slick
Mon Aug 08, 2016 12:42 am
Forum: Python
Topic: tkinter problem
Replies: 4
Views: 914

Re: tkinter problem

studysession wrote:Unsure what to do.... Thanks for the reply

ImportError: No module named tkinter


For python3 I got it working fine.
apt-get install python-tk python3-tk
They have slightly different names
python3
import tkinter

python2
import Tkinter
by tom.slick
Fri Aug 05, 2016 6:12 am
Forum: Python
Topic: Conversion of Datatypes from received values
Replies: 12
Views: 2458

Re: Conversion of Datatypes from received values

Ok, so i've figured out my problem and what i need to do ti fix it. I'm using an nrf24L01 transceiver which is limited to 32 bytes. Thats why its wrapping around after 255. Can anyone help me send greater numbers than that? Maybe in packets? Which NRF24L01 libraries are you using? There are several...
by tom.slick
Thu Aug 04, 2016 9:58 pm
Forum: Python
Topic: Creating Custom LCD Char
Replies: 52
Views: 8474

Re: Creating Custom LCD Char

this might be what your looking for.
http://www.quinapalus.com/hd44780udg.html
by tom.slick
Thu Aug 04, 2016 9:46 pm
Forum: Python
Topic: SMTP email -- 2 recipients
Replies: 13
Views: 2244

Re: SMTP email -- 2 recipients

the split method splits a string into a list. it takes an optional parameter on what to split the string on >>> a = "a-b-c-d-e-f-g" >>> a.split() # split on whitespace if not specified ['a-b-c-d-e-f-g'] >>> a.split("-") ['a', 'b', 'c', 'd', 'e', 'f', 'g'] >>> a.split("d") ['a-b-c-', '-e-f-g'] >>> it...
by tom.slick
Thu Aug 04, 2016 8:21 pm
Forum: Python
Topic: SMTP email -- 2 recipients
Replies: 13
Views: 2244

Re: SMTP email -- 2 recipients

Actually just did this and it works great -- extremely simple. mail.sendmail (sender, receiver.split(','), header + conten t) and I don't have to a list at all -- it acts on my string variable which is receiver = ' [email protected].com, [email protected].com ' now maybe some can explain why it works because I ne...
by tom.slick
Thu Aug 04, 2016 7:33 am
Forum: Python
Topic: SMTP email -- 2 recipients
Replies: 13
Views: 2244

Re: SMTP email -- 2 recipients

If you want to send to multiple recipients use a list not a string.
string = one recipient
list = multiple recipients

Code: Select all

to = ["[email protected]", "[email protected]", "[email protected]"]
msg = "TESTING"
smtpserver.sendmail("[email protected]", to, msg)

Go to advanced search