Thursday, August 21, 2014

Setting the PYTHONPATH with Powershell

Powershell is the Windows hacker's best friend until it isn't.  Actually, I really do enjoy the power you get from Powershell.  However, figuring out how to set my python path in the shell was a frustrating experience that I hope to spare other users from.

PS C:\Users\spearsc> Get-ChildItem Env:PYTHONPATH

Name                                    Value
----                                        -----
PYTHONPATH                     r:/env


PS C:\Users\spearsc> $env:PYTHONPATH = "D:/localenv"
PS C:\Users\spearsc> Get-ChildItem Env:PYTHONPATH

Name                           Value
----                               -----
PYTHONPATH           D:/localenv

There you have it!  Pretty sure this setting is not permanent, which is fine for testing purposes.

Thursday, August 7, 2014

Dealing with the error message: "Cross origin requests are only supported for HTTP."

I know I have dealt with this before, but I found a Stack Overflow thread that does a pretty good job of explaining this problem.  Plus, the thread shows you how to use Python to fire up a simple web server to get around the issue:

http://stackoverflow.com/questions/20041656/xmlhttprequest-cannot-load-file-cross-origin-requests-are-only-supported-for-ht