Category Archives: Web Development

Breaking the Internet

AttributeError: module ‘serial’ has no attribute ‘SerialException’ – Python 3.5

Hi everyone,

A quick fix for an error I ran into while updating to Pyhton 3.5.2:

AttributeError: module 'serial' has no attribute 'SerialException'

I needed to add pyserial:

pi@raspberrypi:~/Desktop/piscripts/get-commands $ sudo pip3.5 install pyserial
Collecting pyserial
  Downloading pyserial-3.4-py2.py3-none-any.whl (193kB)
    100% |████████████████████████████████| 194kB 530kB/s
Installing collected packages: pyserial
Successfully installed pyserial-3.4

Thanks to the following link: https://stackoverflow.com/a/47562659/522859

AttributeError: ‘dict’ object has no attribute ‘iteritems’ – Python

Hey everyone,

Just running through object detection samples for Tensorflow and I encountered the following error:

Sample: https://github.com/GoogleCloudPlatform/tensorflow-object-detection-example

AttributeError: ‘dict’ object has no attribute ‘iteritems’

The issue seems to be that the sample hasn’t been made compatible with Python 3.x. Simply make the following change and it should work:


# Original
for cls, new_image in new_images.iteritems():

# Changed
for cls, new_image in new_images.items():

Thanks to the following StackOverflow post: https://stackoverflow.com/a/30418498/522859

Check if String Contains a Substring – Python

Hey everyone,

Just a quick post on how to check if a string contains a string in python:

if "STRINGTOFIND" in "testtesttestSTRINGTOFINDtestesttest":
# continue

Thanks to this stackoverflow post: https://stackoverflow.com/a/5473023/522859

VirtualDog Tutorial PluralSight

Hey everyone,

Just taking a quick look at Jasmine with Typescript and found a decent looking tutorial on PluralSight with a sample app called VirtualDog. Attempting to run the following command resulted in an error on Windows 10:

npm run bower-typings

> concurrently “bower install” “typings install”

[0] ‘bower’ is not recognized as an internal or external command,
[0] operable program or batch file.
[1] ‘typings’ is not recognized as an internal or external command,
[1] operable program or batch file.
[1] typings install exited with code 1
[0] bower install exited with code 1

npm ERR! Windows_NT 10.0.15063
npm ERR! argv “C:\\Program Files\\nodejs\\node.exe” “C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js” “run” “bower-typings”
npm ERR! node v6.11.3
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! VitrualDog@0.0.1 bower-typings: `concurrently “bower install” “typings install” `
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the VitrualDog@0.0.1 bower-typings script ‘concurrently “bower install” “typings install” ‘.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the VitrualDog package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! concurrently “bower install” “typings install”
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs VitrualDog
npm ERR! Or if that isn’t available, you can get their info via:
npm ERR! npm owner ls VitrualDog
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Chris-PC\Desktop\Testing Javascript with Jasmine and Typescript\virtualdog-begin\npm-debug.log

In order to fix it, just run the following command:
npm install -g bower

Thanks to the following link: https://stackoverflow.com/a/37669968/522859

Exited with code 9009 – Visual Studio Build

Hey everyone,

I ran into the following error today while attempting to build a solution:

combiner exited with code 9009

It apparently means that a file couldn’t be found. The solution was to simply restart visual studio.

I’d been manually adding them to the directory and this is apparently a common cause. See the following Stackoverflow post for more info: https://stackoverflow.com/a/28198020/522859

Running ReadTheDocs on Windows

Hey everyone,

This is a quick guide on how to setup your own readthedocs server on Windows.

Install Python 2.7: https://www.python.org/downloads/

Install virtual env using pip via command prompt (run as administrator):
c:\Python27>python.exe scripts\pip.exe install virtualenv

Create a virtual environment:
c:\Python27>scripts\virtualenv.exe c:\readthedocs
c:\readthedocs\Scripts>activate.bat
(readthedocs) c:\readthedocs\Scripts>

Create a folder and clone the repository:
(readthedocs) c:\readthedocs\Scripts>md checkouts
(readthedocs) c:\readthedocs\Scripts>cd checkouts
(readthedocs) c:\readthedocs\Scripts\checkouts>git clone http://github.com/rtfd/readthedocs.org.git
Cloning into 'readthedocs.org'...
remote: Counting objects: 47896, done.
remote: Compressing objects: 100% (53/53), done.
remote: Total 47896 (delta 19), reused 0 (delta 0), pack-reused 47843
Receiving objects: 100% (47896/47896), 37.91 MiB | 8.76 MiB/s, done.
Resolving deltas: 100% (31783/31783), done.
Checking connectivity... done.

Get and install dependencies using pip:
(readthedocs) c:\readthedocs\Scripts\checkouts>cd readthedocs.org
(readthedocs) c:\readthedocs\Scripts\checkouts\readthedocs.org>git clone http://github.com/rtfd/readthedocs.org.git

Ran into the following error: no module named django.core.management (probably caused by having two version of python installed)
(readthedocs) c:\readthedocs\Scripts\checkouts\readthedocs.org>c:\Python27\python.exe c:\readthedocs\Scripts\pip.exe install django --upgrade
Collecting django
Using cached Django-1.10.2-py2.py3-none-any.whl
Installing collected packages: django
Successfully installed django-1.10.2
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' comm
and.

Build the database:
(readthedocs) c:\readthedocs\Scripts\checkouts\readthedocs.org>c:\Python27\pytho
n.exe C:\readthedocs\Scripts\checkouts\readthedocs.org\manage.py syncdb
Operations to perform:
Synchronize unmigrated apps: allauth, messages, django_extensions, django_grav
atar, rest_framework, annoying, textclassifier, corsheaders, copyright, privacy,
django_countries, humanize, rtd_tests, haystack, doc_builder, staticfiles, rest
api, bitbucket_oauth2, bitbucket, notifications, djangosecure, pagination, githu
b, djcelery, payments
Apply all migrations: core, account, builds, gold, sessions, admin, guardian,
tastypie, messages_extends, comments, sites, contenttypes, redirects, auth, tagg
it, oauth, bookmarks, donate, projects, socialaccount
Synchronizing apps without migrations:
Creating tables...
Creating table corsheaders_corsmodel
Creating table celery_taskmeta
Creating table celery_tasksetmeta
Creating table djcelery_intervalschedule
Creating table djcelery_crontabschedule
Creating table djcelery_periodictasks
Creating table djcelery_periodictask
Creating table djcelery_workerstate
Creating table djcelery_taskstate
Running deferred SQL...
Installing custom SQL...
Running migrations:
Rendering model states... DONE
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying account.0001_initial... OK
Applying account.0002_email_max_length... OK
Applying admin.0001_initial... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying taggit.0001_initial... OK
Applying projects.0001_initial... OK
Applying builds.0001_initial... OK
Applying projects.0002_add_importedfile_model... OK
Applying bookmarks.0001_initial... OK
Applying builds.0002_build_command_initial... OK
Applying comments.0001_initial... OK
Applying core.0001_initial... OK
Applying core.0002_make_userprofile_user_a_onetoonefield... OK
Applying core.0003_add_banned_status... OK
Applying donate.0001_initial... OK
Applying donate.0002_dollar-drop-choices... OK
Applying donate.0003_add-impressions... OK
Applying donate.0004_rebase-impressions-on-base... OK
Applying donate.0005_add-geo-filters... OK
Applying donate.0006_add-geo-data... OK
Applying donate.0007_add-impression-totals... OK
Applying gold.0001_initial... OK
Applying guardian.0001_initial... OK
Applying messages_extends.0001_initial... OK
Applying sites.0001_initial... OK
Applying socialaccount.0001_initial... OK
Applying socialaccount.0002_token_max_lengths... OK
Applying oauth.0001_initial... OK
Applying oauth.0002_combine_services... OK
Applying oauth.0003_move_github... OK
Applying oauth.0004_drop_github_and_bitbucket_models... OK
Applying oauth.0005_add_account_relation... OK
Applying oauth.0006_move_oauth_source... OK
Applying oauth.0007_org_slug_nonunique... OK
Applying projects.0003_project_cdn_enabled... OK
Applying projects.0004_add_project_container_image... OK
Applying projects.0005_sync_project_model... OK
Applying projects.0006_add_domain_models... OK
Applying projects.0007_migrate_canonical_data... OK
Applying projects.0008_add_subproject_alias_prefix... OK
Applying projects.0009_add_domain_field... OK
Applying projects.0010_migrate_domain_data... OK
Applying projects.0011_delete-url... OK
Applying projects.0012_proper-name-for-install-project... OK
Applying projects.0013_add-container-limits... OK
Applying projects.0014_add-state-tracking... OK
Applying projects.0015_add_project_allow_promos... OK
Applying projects.0016_build-queue-name... OK
Applying projects.0017_add_domain_https... OK
Applying redirects.0001_initial... OK
Applying sessions.0001_initial... OK
Applying taggit.0002_auto_20150616_2121... OK
Applying tastypie.0001_initial... OK

Starting the readthedocs server:
D:\Users\ChrisO>C:\readthedocs\Scripts\activate.bat

(readthedocs) D:\Users\ChrisO>c:\Python27\python.exe C:\readthedocs\Scripts\chec
kouts\readthedocs.org\manage.py runserver
Performing system checks…

System check identified no issues (1 silenced).
October 21, 2016 – 11:16:17
Django version 1.8.3, using settings ‘readthedocs.settings.dev’
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.

Create a new readthedocsproject:
I followed this guide: http://read-the-docs.readthedocs.io/en/latest/getting_started.html#in-rst

Creating the new project:
C:\readthedocs>md whatibroke
C:\readthedocs>cd whatibroke
C:\readthedocs\whatibroke>C:\readthedocs\Scripts\sphinx-quickstart.exe
Welcome to the Sphinx 1.3.5 quickstart utility.

Please enter values for the following settings (just press Enter to
accept a default value, if one is given in brackets).

Installing a theme – sphinx_rtd_theme (optional step):
c:\readthedocs\Scripts>activate.bat
(readthedocs) c:\readthedocs\Scripts>cd c:\readthedocs\whatibroke
(readthedocs) c:\readthedocs\whatibroke>pip install sphinx_rtd_theme

In your conf.py file (C:\readthedocs\whatibroke\conf.py):
import sphinx_rtd_theme
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

Building your output:
c:\readthedocs\Scripts>activate.bat
(readthedocs) c:\readthedocs\Scripts>cd c:\readthedocs\whatibroke
(readthedocs) c:\readthedocs\whatibroke>make html
Running Sphinx v1.3.5
loading pickled environment... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 0 source files that are out of date
updating environment: 0 added, 0 changed, 0 removed
looking for now-outdated files... none found
no targets are out of date.
build succeeded.

Build finished. The HTML pages are in _build/html.

Thanks to the following stackoverflow post for a lot of the information here: http://stackoverflow.com/a/19892345/522859

Unable to Access RDS Database from Elastic Beanstalk Application

Hey everyone,

I ran into a bit of an issue today where I was unable to access my RDS SQL Express instance from my .NET Elastic Beanstalk instance. I was receiving the following error:

1
The server was not found or was not accessible.

The solution turned out to be fairly simply thanks to this StackOverflow post: http://stackoverflow.com/a/33207022/522859

Get your server instance security group:
– Log into AWS
– Navigate to elastic beanstalk
– Open your application instance
– Open configuration
– Open instances
– Find “server” on the page and copy the value in the “EC2 security groups” field

Add your server instance security group to your rds rules:
– Navigate to the RDS Dashboard
– Open your RDS instance
– Click on view details (left hand side or top)
– Find Security and Network
– Click on the rds-launch-wizard under security groups
– Click on inbound rules (very bottom currently)
– Add a new inbound rule with the copied security group as the source

How to Add a FontAwesome Icon using :after

Hey everyone,

Just a quick post on how to add a fontawesome icon using :after:


.fl-cart-product-price:after{
content: '\f00d';
font-family: FontAwesome;
font-weight: normal;
font-style: normal;
margin: 0px 0px 0px 10px;
color: #555;
font-size: 85%;
text-decoration: none;
}

See this stackoverflow post for more info: http://stackoverflow.com/a/18793584/522859

Unilateral receiver not allowed in chained payment is restricted – Adaptive Payment DotNet SDK

Hey everyone,

Just an error I ran into today while using the Adaptive Payments SDK for C#/.NET:

Unilateral receiver not allowed in chained payment is restricted

Thankfully this one is fairly simple – one of the receivers hasn’t confirmed their account.

http://stackoverflow.com/a/32816078/522859

Could not find part of the path ‘C:\x\lib’ – Adding new Web API Project

Hey everyone,

I ran into the following error when I tried to add a new Web API project in Visual Studio Express 2015 for Web:

Could not find part of the path ‘C:\x\lib’

The workaround for this was to temporarily unbind the project from TFS: File > Source Control > Advanced > Change Source Control > Click unbind on each of the projects

While not the same problem, this post helped me out: https://github.com/NuGet/Home/issues/1164