7

It works fine on my other computer, but after setting up Google App Engine and creating the main.py and app.yaml files, I run dev_appserver.py app.yaml in Windows command prompt and instead of deploying the app to localhost:8080 it just opens this text file, which I will shorten:

#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
"""Convenience wrapper for starting an appengine tool."""

import os
import sys

sys_path = sys.path
try:
  sys.path = [os.path.dirname(__file__)] + sys.path

  import wrapper_util

finally:
  sys.path = sys_path

wrapper_util.reject_old_python_versions((2, 7))

_DIR_PATH = wrapper_util.get_dir_path(__file__, os.path.join('lib', 'ipaddr'))
_PATHS = wrapper_util.Paths(_DIR_PATH)

etc. etc.

What is going on here? Everything is set up identically to my other pc. It should work.

ian-campbell
  • 1,605
  • 1
  • 20
  • 42

3 Answers3

15

SOLVED! The .py files were all set to open with idle.bat so I had to go into Control Panel\Programs\Default Programs\Set Associations and change the .py file association to python.exe. Now everything works like a charm.

ian-campbell
  • 1,605
  • 1
  • 20
  • 42
  • 1
    Got exactly the same issue on windows 10, when VSCode installed pylint it also changed the file association... But I'm struggling to restore it, your solution doesn't work on windows 10 – Cyril Feb 09 '20 at 08:56
  • 2
    Got the same problem in windows 10. Your solution fixed it. Although the location to set association is different for windows 10. In win10 go to: Control Panel\Programs\Default Programs\Associate file type or protocol with a program. It opens a window for Default apps. Scroll down and click on "Choose default apps by file type" . Again scroll down to find ".py" extension. On the right to the extension click on the app icon and choose python. Hope it helps someone. Cheers. – Avishekh Bharati Mar 25 '20 at 00:30
2

Is Python installed on this computer? What you're seeing is that Windows doesn't know that ".py" files are associated with Python.

Installing SetupTools on 64-bit Windows might provide some helpful info.

Community
  • 1
  • 1
Dave W. Smith
  • 24,318
  • 4
  • 40
  • 46
  • 1
    Yes, I have Python 2.7 and Python 3.4 installed and included in my PATH. The app uploads fine with the GAE gui, just not with command prompt. – ian-campbell Jul 03 '14 at 02:56
0

you should supply project directory to dev_appserver.py not app.yaml. please refer to GAE python hello world example for more info. let's say your project-Dir is

"/home/rami/GAEproejcts/myfirstproject"

and your dev_appserver.py is at

"/home/rami/GAEinstalldirectory/"

. then just run:

$ /home/rami/GAEinstalldirectory/dev_appserver.py /home/rami/GAEproejcts/myfirstproject

this should work.

Kamyar Ghasemlou
  • 859
  • 2
  • 9
  • 24
  • I am already in my project directory when I run dev_appserver.py. – ian-campbell Jul 03 '14 at 02:57
  • no, i mean assume your project directory is myproject, you should run "dev_appserver.py " please check 7:00 in this video http://www.youtube.com/watch?v=YkjyXBU7z48, it is on ubuntu but GAE appserver works same on all platforms. – Kamyar Ghasemlou Jul 03 '14 at 14:39
  • Kamyar, I don't really follow. I watched that video, did exactly what it said, and it did not work. Can you perhaps give an answer that does not include a link? – ian-campbell Jul 03 '14 at 15:10
  • see the post, i am updating it. – Kamyar Ghasemlou Jul 03 '14 at 15:18
  • Why is it that on my other computer, (set up the same as this one), all I have to write is dev_appserver.py app.yaml? It sets up a localhost:8080 site in my browser to view my app. – ian-campbell Jul 03 '14 at 20:00
  • Also, I tried your solution, and nothing happened. it says "Program_files_(x86) is not recognized as an internal or external command, operable program, or batch file." – ian-campbell Jul 03 '14 at 20:10