hcarter333 / ham-radio-freedom

0 stars 0 forks source link

ReDeploy simplified app in Google Cloud with Python27 #3

Closed hcarter333 closed 1 year ago

hcarter333 commented 1 year ago

The app is not simple to move to Python 3. Modify it to continue to use Python27.

hcarter333 commented 1 year ago

I've worked around the first set of issues. The key thing was to change the first version of app.yaml from

application: copaseticflows-hrd  
version: 1  
runtime: python  
api_version: 1  

to

runtime: python27  
api_version: 1  
threadsafe: false  

The next step was to remove references to Facebook modules that are no longer used anyway.

Mainhandler:

class MainHandler(webapp.RequestHandler):
    def get(self):
        values = {
        }
        self.response.out.write(
          template.render('fronttest.html', values))

    def post(self):
        user = User(name = self.request.get('user'),
                    password = self.request.get('password'))
        user.put()        
#        self.redirect('/')

had an issue in not being able to find fronttest.html. The file is the old front page of the website. Rather than trying to make it work, I switched it out for the desired ham radio testing page, ham_exam_simple.html.

hcarter333 commented 1 year ago

The next error message was:

UnicodeDecodeError: 'utf8' codec can't decode byte 0xff in position 964489: invalid start byte

at .decode ( [/base/alloc/tmpfs/dynamic_runtimes/python27g/d8396ee824abfb26/python27/python27_dist/lib/python2.7/encodings/utf_8.py:16](https://console.cloud.google.com/debug?referrer=fromlog&file=%2Fbase%2Falloc%2Ftmpfs%2Fdynamic_runtimes%2Fpython27g%2Fd8396ee824abfb26%2Fpython27%2Fpython27_dist%2Flib%2Fpython2.7%2Fencodings%2Futf_8.py&line=16&project=hamdaise) )
at .load_template_source ( [/base/alloc/tmpfs/dynamic_runtimes/python27g/d8396ee824abfb26/python27/python27_lib/versions/1/google/appengine/_internal/django/template/loaders/filesystem.py:39](https://console.cloud.google.com/debug?referrer=fromlog&file=%2Fbase%2Falloc%2Ftmpfs%2Fdynamic_runtimes%2Fpython27g%2Fd8396ee824abfb26%2Fpython27%2Fpython27_lib%2Fversions%2F1%2Fgoogle%2Fappengine%2F_internal%2Fdjango%2Ftemplate%2Floaders%2Ffilesystem.py&line=39&project=hamdaise) )
at .load_template_source ( [/base/alloc/tmpfs/dynamic_runtimes/python27g/d8396ee824abfb26/python27/python27_lib/versions/1/google/appengine/_internal/django/template/loaders/filesystem.py:60](https://console.cloud.google.com/debug?referrer=fromlog&file=%2Fbase%2Falloc%2Ftmpfs%2Fdynamic_runtimes%2Fpython27g%2Fd8396ee824abfb26%2Fpython27%2Fpython27_lib%2Fversions%2F1%2Fgoogle%2Fappengine%2F_internal%2Fdjango%2Ftemplate%2Floaders%2Ffilesystem.py&line=60&project=hamdaise) )
at .find_template ( [/base/alloc/tmpfs/dynamic_runtimes/python27g/d8396ee824abfb26/python27/python27_lib/versions/1/google/appengine/_internal/django/template/loader.py:134](https://console.cloud.google.com/debug?referrer=fromlog&file=%2Fbase%2Falloc%2Ftmpfs%2Fdynamic_runtimes%2Fpython27g%2Fd8396ee824abfb26%2Fpython27%2Fpython27_lib%2Fversions%2F1%2Fgoogle%2Fappengine%2F_internal%2Fdjango%2Ftemplate%2Floader.py&line=134&project=hamdaise) )
at .get_template ( [/base/alloc/tmpfs/dynamic_runtimes/python27g/d8396ee824abfb26/python27/python27_lib/versions/1/google/appengine/_internal/django/template/loader.py:157](https://console.cloud.google.com/debug?referrer=fromlog&file=%2Fbase%2Falloc%2Ftmpfs%2Fdynamic_runtimes%2Fpython27g%2Fd8396ee824abfb26%2Fpython27%2Fpython27_lib%2Fversions%2F1%2Fgoogle%2Fappengine%2F_internal%2Fdjango%2Ftemplate%2Floader.py&line=157&project=hamdaise) )
at ._load_internal_django ( [/base/alloc/tmpfs/dynamic_runtimes/python27g/d8396ee824abfb26/python27/python27_lib/versions/1/google/appengine/ext/webapp/template.py:163](https://console.cloud.google.com/debug?referrer=fromlog&file=%2Fbase%2Falloc%2Ftmpfs%2Fdynamic_runtimes%2Fpython27g%2Fd8396ee824abfb26%2Fpython27%2Fpython27_lib%2Fversions%2F1%2Fgoogle%2Fappengine%2Fext%2Fwebapp%2Ftemplate.py&line=163&project=hamdaise) )
at .render ( [/base/alloc/tmpfs/dynamic_runtimes/python27g/d8396ee824abfb26/python27/python27_lib/versions/1/google/appengine/ext/webapp/template.py:89](https://console.cloud.google.com/debug?referrer=fromlog&file=%2Fbase%2Falloc%2Ftmpfs%2Fdynamic_runtimes%2Fpython27g%2Fd8396ee824abfb26%2Fpython27%2Fpython27_lib%2Fversions%2F1%2Fgoogle%2Fappengine%2Fext%2Fwebapp%2Ftemplate.py&line=89&project=hamdaise) )
at .get ( [/base/data/home/apps/m~hamdaise/20230121t125025.449450681435159390/main.py:1544](https://console.cloud.google.com/debug?referrer=fromlog&file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fm~hamdaise%2F20230121t125025.449450681435159390%2Fmain.py&line=1544&project=hamdaise) )

Which was much easier to debug once I believed it was actually what it said it was. Using hexedit to go to position

964489 aka 0xeb789 I could see

image

indicating the space is encoded as 0xff (weird)

It was in a line that had been commented out, so I simply removed it.

hcarter333 commented 1 year ago

Simple test cases are now deploying! (They still have the old question pool, but that's #2 ) screencast-mail google com-2023 01 21-13_34_24