Showing posts from November, 2018

python simple finite state machine and logger

Doing another exercise from LMPTHW, and I'm enjoying it.
Only broke into Maximum recursion depth once so far.

Also I found this good article on logger, and I am really going to start using it from now on.  Just yeah.  It's not much work at all to put it in there.
---logger article:

So a picture of what my plan was going in:

And a picture of the code results in Command Prompt ( Bash ):

color codes link :
And I'm not sure I can explain well enough yet, but basically you're making a 'machine'  that transitions to a predetermined amount of settings -- states.
In my code, it's  the class's functions [ FSM_OFF, FSM_GO, FSM_GREEN, FSM_YELLOW, FSM_RED, FSM_BLINKING_RED, FSM_ERROR]

And the list of triggers/instructions to change the state are determined in each of those states.     **FSM_BLINKING_RED is…

Getting some NLTK running in my Django website

First off,  Some links:

Django Girls Tutorial

NLTK site

And if you wanna see the website in action:

If your a new reader and haven't seen my work with NLTK, a quick note that I did a lot of playing with it to see how it all works.

You can refer to this blog link to see some of the work:


I followed all my own instructions to make nltk functional in the pythonanywhere server:

Enter your python virtual environment:
on my server: (bash) source <name of your env>/bin/activate
You might have a different set up.
My pythonanywhere runs my site through the virtual environment
The Django Girls Tutorial is excellent for all this information.

1) pip install -U nltk
2) pip install -U numpy

open the python shell and:
>>>import nltk
< Stuff happens Cross your fingers for no errors!>
<Stuff happens *finger…

Django & Mysite.settings import errors

Tutorials are Awesome!  
Check it out!  my site: Nellies Noodles
I found this django tutorial, and it is damn good.
That is unless you don't know what your doing, like me, and just try to skip to the parts you want to see because you think you can do it all alone...
Lesson learned.
Django Tutorial

I'm going to go over a few things that really threw me off, so if someone else is trying this for the first time, they'll have a little hint where to look.

Besides the whole, I can skip ahead of this yak shaving bit! , issue, When I finally removed my initial project and started new, and got to the point that everything should have worked, these are the problems I encountered.

1)  When trying to find the 'link' to my live and running website, I had to create the Web App first.

The first few times, the  pythonanywhere  did not see I already had the Django files  and set the new directory empty expecting me to make the django app inside it.  *the has a fre…

NLTK python , getting Wiwa to answer to interjections

Todays short project is to get my Whispering Wall, Wiwa, a way to answer to interjections.

I often have people I know play with her, to watch what I need to update and fix.
My best friend used things such as: 'Wow' and 'Really', and Wiwa did not know what to do with a one word response.

She either tagged it as a noun, and grabbed from the noun script, or it answered with the 'Is the cat on the keyboard?' because the UH (interjection) tag was not being used, and therefor the words were not being processed leading to an empty list to grab a response from.

So first step is to remember how this works, then open a file and start testing out tagging interjections.

websites used:
   # Having trouble finding out why my interjections are always tagged:
   # [('WOW', NN)] -- Noun ,  instead of the expected [('WOW', UH)] -- interjection 

playing with python Arcade

I wanted to give python Arcade a test run.
link to website I used: html
I like pygame, but it seems to be being not kept up, (I could just be looking in all the wrong places).
This seems really promising.
Here's some crazy errors I had ,  and in the code I'll comment how I got that.

I thought the virtual environment was the problem at first.
The documentation had a warning that Arcade doesn't do well in virtual environments.

But nope.  That wasn't it.
Maybe it contributed.

And success!  In virtual env, and without.

Anyways, back to yack shaving soon!

Here's some python Arcade code:

######### #########
import arcade
# I still think putting what you are going to use as globals
# is safer if you put them in a class, and access them through there
# I'd be happy for someone to explain why not
class Config_urations(object):
def __init__(self):
      self.WIDTH = 800
      self.HEIGHT = 600
      self.INTRO = 'HELLO ARCADE!'