Intermediate and Advanced Software Carpentry in Python

I am taking a slight break from C++, going back to Python, one of my favorite languages ever! I found the following material on structuring Python code and it is great! Posting it here so I can always come back to it. I recommend it to all the Python enthusiast looking at ways to improve their coding structure. Intermediate and […]

Python URL Term Scrapper (Kind of Like a Very Dumb/Simple Watson)

I wrote this a while back to scrape a given URL page for all links it contains and then search those links for term relations. The Python scrapper first finds all links in a given url. It then searches all the links found for a list of search terms provided. It will return stats on the number of times specific […]

Python TypeError: expected a character buffer object

Error I received the following python error: TypeError: expected a character buffer object The below screenshot shows my code. Solution I was using the replace method, while the better method for my situation would be to use the re.sub(patter, replace, string) method, the new line became: my_text = re.sub(comp, ‘#undef SEEK_SET\n#undef SEEK_END\n #undef SEEK_CUR\n#include ‘, f) The replace method expects […]

SSL Encryption for Django’s Local/Native Server

Django comes packaged with a lightweight python server. It is not intended to be a production server but more a testing/development host. Running the server is as easy as running the following command within a Django project: python manage.py runserver Since it’s so lightweight, it doesn’t come with the same abilities as other servers like Apache or Nginx. It can’t […]

PIR Sensor on the Pi

Today I soldered a PIR sensor to my Pi! Basically, I want it to detect movement and turn on a LCD screen, then turn the screen off again after a minute of no movement. So when I walk into a room, the screen turns on and when I leave, the screen turns off. Equipment My Pi (See early Posts) PIR […]