Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Cannot get past getting babel to work on my Windows 10 computer
I keep getting the following error ever since I got to the part of adding babel in the video:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:<file location>. (Reason: CORS request not http)
I installed python 3 onto my pc to attempt the other post's answer of "python -m SimpleHTTPServer", but it isn't working for me.
Gergely BoczTreehouse Moderator 14,217 Points
While browsing the web, i found out that the python http server requires additional settings, therefore additional code to to enable CORS. The first example should work with python 3, but just in case i'll share the link to another.
Here is the first example by link and by code:
#!/usr/bin/env python # Usage: python cors_http_server.py <port> try: # try to use Python 3 from http.server import HTTPServer, SimpleHTTPRequestHandler, test as test_orig import sys def test (*args): test_orig(*args, port=int(sys.argv) if len(sys.argv) > 1 else 8000) except ImportError: # fall back to Python 2 from BaseHTTPServer import HTTPServer, test from SimpleHTTPServer import SimpleHTTPRequestHandler class CORSRequestHandler (SimpleHTTPRequestHandler): def end_headers (self): self.send_header('Access-Control-Allow-Origin', '*') SimpleHTTPRequestHandler.end_headers(self) if __name__ == '__main__': test(CORSRequestHandler, HTTPServer)
And here is a link to the second example.
I hope it solves your problem! If not, try to ping someone else, who has experience with python!
Good luck, Gergő