Re: [google-appengine] Re: import 2nd library

2020-11-11 Thread John Iacovacci
Issue solved, I did not have the entries in requirements.txt. Error
messages too vague

On Wed, Nov 11, 2020 at 9:13 PM wesley chun  wrote:

> That's quite odd John. Can you temporarily rename your main.py and deploy
> this code as main.py and run it?
>
> from flask import Flask
> from google import cloud
>
> app = Flask(__name__)
>
> @app.route('/')
> def hello_world():
> return 'Hello, World!'
>
> Pls reply with what shows up in your App Engine dashboard
>  down in the "Application
> Errors" section.
> Also paste relevant lines from your app.yaml (or the whole thing).
>
> Thanks,
> --Wesley
>
> On Wed, Nov 11, 2020 at 12:17 PM John Iacovacci 
> wrote:
>
>> I've isolated the problem down to my app engine python code not allowing
>> me to import more than one module. Even a simple hello world app will only
>> allow me to implement one import. Every time I add a module to any of my
>> program I get errors.
>>
>> On Wed, Nov 11, 2020 at 2:58 PM 'Elliott (Cloud Platform Support)' via
>> Google App Engine  wrote:
>>
>>> Hello,
>>>
>>> To isolate the problem, does this code run locally on your machine?
>>>
>>> On Wednesday, November 11, 2020 at 12:18:48 PM UTC-5
>>> john.ia...@gmail.com wrote:
>>>
 I'm trying to import the datastore module(or anytime I try to import a
 second module for that matter) in my app engine standard code.

 I've virtually tried every combination and I'm getting either

 Error: Server ErrorThe server encountered an error and could not
 complete your request.

 Please try again in 30 seconds.


 or 502 Gateway ngix errors.


 Any thoughts?


 Thanks


 John Iacovacci

 main.py
 from flask import Flask, request, render_template

 # START Translate requirements
 from google.cloud import translate_v2 as translate
 translate_client = translate.Client()

 import datastore
 # END Translate requirements


 app = Flask(__name__)   # Flask is the web framework we're using


 @app.route('/', methods=['POST','GET']) # This defines when the 
 function below will be called
 def translate():
 if request.method == 'POST':

 # This code will run if a POST is received

 data = request.form.to_dict(flat=True)  # Reads the body of the 
 post request and assigns it to the "data" variable

 result = translate_client.translate(data['inputText'], 
 target_language=data["toLang"]) # Sends data to the translate API

 return 
 render_template('index.html',translatedText=result['translatedText'])# 
 Renders the page with the response

 else:

 # This code will run if a GET is received
 return render_template('index.html')


 # Don't worry about this part
 if __name__ == '__main__':
 app.run(host='127.0.0.1', port=8080, debug=True)

>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Google App Engine" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to google-appengine+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/google-appengine/02857814-1a89-4d13-b0cb-eaa593e2dba9n%40googlegroups.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google App Engine" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to google-appengine+unsubscr...@googlegroups.com.
>>
> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/google-appengine/CADTT8SQZP_svALjuaUY_SFf%2Bdim%2BV_uGZHHPmruXFGqbvZyMvA%40mail.gmail.com
>> 
>> .
>>
>
>
> --
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> "A computer never does what you want... only what you tell it."
> wesley chun :: @wescpy  :: Software
> Architect & Engineer
> Developer Advocate at Google Cloud by day; at night...
> Python training & consulting : http://CyberwebConsulting.com
> "Core Python" books : http://CorePython.com
> Python blog: http://wescpy.blogspot.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-appengine+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> 

Re: [google-appengine] Re: import 2nd library

2020-11-11 Thread wesley chun
That's quite odd John. Can you temporarily rename your main.py and deploy
this code as main.py and run it?

from flask import Flask
from google import cloud

app = Flask(__name__)

@app.route('/')
def hello_world():
return 'Hello, World!'

Pls reply with what shows up in your App Engine dashboard
 down in the "Application
Errors" section.
Also paste relevant lines from your app.yaml (or the whole thing).

Thanks,
--Wesley

On Wed, Nov 11, 2020 at 12:17 PM John Iacovacci 
wrote:

> I've isolated the problem down to my app engine python code not allowing
> me to import more than one module. Even a simple hello world app will only
> allow me to implement one import. Every time I add a module to any of my
> program I get errors.
>
> On Wed, Nov 11, 2020 at 2:58 PM 'Elliott (Cloud Platform Support)' via
> Google App Engine  wrote:
>
>> Hello,
>>
>> To isolate the problem, does this code run locally on your machine?
>>
>> On Wednesday, November 11, 2020 at 12:18:48 PM UTC-5 john.ia...@gmail.com
>> wrote:
>>
>>> I'm trying to import the datastore module(or anytime I try to import a
>>> second module for that matter) in my app engine standard code.
>>>
>>> I've virtually tried every combination and I'm getting either
>>>
>>> Error: Server ErrorThe server encountered an error and could not
>>> complete your request.
>>>
>>> Please try again in 30 seconds.
>>>
>>>
>>> or 502 Gateway ngix errors.
>>>
>>>
>>> Any thoughts?
>>>
>>>
>>> Thanks
>>>
>>>
>>> John Iacovacci
>>>
>>> main.py
>>> from flask import Flask, request, render_template
>>>
>>> # START Translate requirements
>>> from google.cloud import translate_v2 as translate
>>> translate_client = translate.Client()
>>>
>>> import datastore
>>> # END Translate requirements
>>>
>>>
>>> app = Flask(__name__)   # Flask is the web framework we're using
>>>
>>>
>>> @app.route('/', methods=['POST','GET']) # This defines when the 
>>> function below will be called
>>> def translate():
>>> if request.method == 'POST':
>>>
>>> # This code will run if a POST is received
>>>
>>> data = request.form.to_dict(flat=True)  # Reads the body of the 
>>> post request and assigns it to the "data" variable
>>>
>>> result = translate_client.translate(data['inputText'], 
>>> target_language=data["toLang"]) # Sends data to the translate API
>>>
>>> return 
>>> render_template('index.html',translatedText=result['translatedText'])# 
>>> Renders the page with the response
>>>
>>> else:
>>>
>>> # This code will run if a GET is received
>>> return render_template('index.html')
>>>
>>>
>>> # Don't worry about this part
>>> if __name__ == '__main__':
>>> app.run(host='127.0.0.1', port=8080, debug=True)
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google App Engine" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to google-appengine+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/google-appengine/02857814-1a89-4d13-b0cb-eaa593e2dba9n%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-appengine+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-appengine/CADTT8SQZP_svALjuaUY_SFf%2Bdim%2BV_uGZHHPmruXFGqbvZyMvA%40mail.gmail.com
> 
> .
>


-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"A computer never does what you want... only what you tell it."
wesley chun :: @wescpy  :: Software
Architect & Engineer
Developer Advocate at Google Cloud by day; at night...
Python training & consulting : http://CyberwebConsulting.com
"Core Python" books : http://CorePython.com
Python blog: http://wescpy.blogspot.com

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/CAB6eaA50EiJne-8syMHXbHyuYT30Kk4NkesDcb9vwRr0avSF6g%40mail.gmail.com.


Re: [google-appengine] Re: import 2nd library

2020-11-11 Thread John Iacovacci
I've isolated the problem down to my app engine python code not allowing me
to import more than one module. Even a simple hello world app will only
allow me to implement one import. Every time I add a module to any of my
program I get errors.

On Wed, Nov 11, 2020 at 2:58 PM 'Elliott (Cloud Platform Support)' via
Google App Engine  wrote:

> Hello,
>
> To isolate the problem, does this code run locally on your machine?
>
> On Wednesday, November 11, 2020 at 12:18:48 PM UTC-5 john.ia...@gmail.com
> wrote:
>
>> I'm trying to import the datastore module(or anytime I try to import a
>> second module for that matter) in my app engine standard code.
>>
>> I've virtually tried every combination and I'm getting either
>>
>> Error: Server ErrorThe server encountered an error and could not complete
>> your request.
>>
>> Please try again in 30 seconds.
>>
>>
>> or 502 Gateway ngix errors.
>>
>>
>> Any thoughts?
>>
>>
>> Thanks
>>
>>
>> John Iacovacci
>>
>> main.py
>> from flask import Flask, request, render_template
>>
>> # START Translate requirements
>> from google.cloud import translate_v2 as translate
>> translate_client = translate.Client()
>>
>> import datastore
>> # END Translate requirements
>>
>>
>> app = Flask(__name__)   # Flask is the web framework we're using
>>
>>
>> @app.route('/', methods=['POST','GET']) # This defines when the 
>> function below will be called
>> def translate():
>> if request.method == 'POST':
>>
>> # This code will run if a POST is received
>>
>> data = request.form.to_dict(flat=True)  # Reads the body of the post 
>> request and assigns it to the "data" variable
>>
>> result = translate_client.translate(data['inputText'], 
>> target_language=data["toLang"]) # Sends data to the translate API
>>
>> return 
>> render_template('index.html',translatedText=result['translatedText'])# 
>> Renders the page with the response
>>
>> else:
>>
>> # This code will run if a GET is received
>> return render_template('index.html')
>>
>>
>> # Don't worry about this part
>> if __name__ == '__main__':
>> app.run(host='127.0.0.1', port=8080, debug=True)
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-appengine+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-appengine/02857814-1a89-4d13-b0cb-eaa593e2dba9n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/CADTT8SQZP_svALjuaUY_SFf%2Bdim%2BV_uGZHHPmruXFGqbvZyMvA%40mail.gmail.com.


[google-appengine] Re: ImportError OpenCV libraries when deploying application via Google App

2020-11-11 Thread 'Elliott (Cloud Platform Support)' via Google App Engine
Hello,

To move this along and to isolate the problem to other than GoogleApp, I 
would suggest deploying your application using the Google Cloud SDK 
 with the command 
without quotes:


"gcloud components update"

Followed by (without quotes):

"gcloud app deploy"

If you are able to deploy correctly with the Google Cloud SDK, you may 
assume that your code and environment works as usual.

On Wednesday, November 11, 2020 at 12:20:37 PM UTC-5 use...@gmail.com wrote:

> Hi!
>
> I'm tried to deploy my flask+opencv (python 3.8) application via 
> GoogleApp, but recieve strange error: 
>
> ERROR: (gcloud.app.deploy) Error Response: [9] 
> Application startup error! Code: APP_CONTAINER_CRASHED
> Traceback (most recent call last):
>   File "app.py", line 6, in 
> from video_proc import *
>   File "/home/vmagent/app/video_proc.py", line 1, in 
> import cv2
>   File "/env/lib/python3.7/site-packages/cv2/__init__.py", line 5, in 
> 
> from .cv2 import *
> ImportError: libGL.so.1: cannot open shared object file: No such file or 
> directory
>
>
> Looks like docker container in GoogleApp havent needed library for OpenCv. 
> Any ideas, how to fix it? 
> Thanks
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/1dd7a3da-ed7e-40e0-aec0-4239e652dbd3n%40googlegroups.com.


[google-appengine] Re: import 2nd library

2020-11-11 Thread 'Elliott (Cloud Platform Support)' via Google App Engine
Hello,

To isolate the problem, does this code run locally on your machine?

On Wednesday, November 11, 2020 at 12:18:48 PM UTC-5 john.ia...@gmail.com 
wrote:

> I'm trying to import the datastore module(or anytime I try to import a 
> second module for that matter) in my app engine standard code.
>
> I've virtually tried every combination and I'm getting either
>
> Error: Server ErrorThe server encountered an error and could not complete 
> your request.
>
> Please try again in 30 seconds.
>
>
> or 502 Gateway ngix errors.
>
>
> Any thoughts?
>
>
> Thanks
>
>
> John Iacovacci
>
> main.py
> from flask import Flask, request, render_template
>
> # START Translate requirements
> from google.cloud import translate_v2 as translate
> translate_client = translate.Client()
>
> import datastore
> # END Translate requirements
>
>
> app = Flask(__name__)   # Flask is the web framework we're using
>
>
> @app.route('/', methods=['POST','GET']) # This defines when the 
> function below will be called
> def translate():
> if request.method == 'POST':
>
> # This code will run if a POST is received
>
> data = request.form.to_dict(flat=True)  # Reads the body of the post 
> request and assigns it to the "data" variable
>
> result = translate_client.translate(data['inputText'], 
> target_language=data["toLang"]) # Sends data to the translate API
>
> return 
> render_template('index.html',translatedText=result['translatedText'])# 
> Renders the page with the response
>
> else:
>
> # This code will run if a GET is received
> return render_template('index.html')
>
>
> # Don't worry about this part
> if __name__ == '__main__':
> app.run(host='127.0.0.1', port=8080, debug=True)
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/02857814-1a89-4d13-b0cb-eaa593e2dba9n%40googlegroups.com.


[google-appengine] ImportError OpenCV libraries when deploying application via Google App

2020-11-11 Thread Mike Borisov
Hi!

I'm tried to deploy my flask+opencv (python 3.8) application via GoogleApp, 
but recieve strange error: 

ERROR: (gcloud.app.deploy) Error Response: [9] 
Application startup error! Code: APP_CONTAINER_CRASHED
Traceback (most recent call last):
  File "app.py", line 6, in 
from video_proc import *
  File "/home/vmagent/app/video_proc.py", line 1, in 
import cv2
  File "/env/lib/python3.7/site-packages/cv2/__init__.py", line 5, in 

from .cv2 import *
ImportError: libGL.so.1: cannot open shared object file: No such file or 
directory


Looks like docker container in GoogleApp havent needed library for OpenCv. 
Any ideas, how to fix it? 
Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/1ed3aeba-b98a-4a97-acc9-dc243588cbbfn%40googlegroups.com.


[google-appengine] import 2nd library

2020-11-11 Thread John Iacovacci
I'm trying to import the datastore module(or anytime I try to import a 
second module for that matter) in my app engine standard code.

I've virtually tried every combination and I'm getting either

Error: Server ErrorThe server encountered an error and could not complete 
your request.

Please try again in 30 seconds.


or 502 Gateway ngix errors.


Any thoughts?


Thanks


John Iacovacci

main.py
from flask import Flask, request, render_template

# START Translate requirements
from google.cloud import translate_v2 as translate
translate_client = translate.Client()

import datastore
# END Translate requirements


app = Flask(__name__)   # Flask is the web framework we're using

@app.route('/', methods=['POST','GET']) # This defines when the 
function below will be called
def translate():
if request.method == 'POST':

# This code will run if a POST is received
data = request.form.to_dict(flat=True)  # Reads the body of the post 
request and assigns it to the "data" variable
result = translate_client.translate(data['inputText'], 
target_language=data["toLang"]) # Sends data to the translate API
return 
render_template('index.html',translatedText=result['translatedText'])# 
Renders the page with the response

else:

# This code will run if a GET is received
return render_template('index.html')


# Don't worry about this part
if __name__ == '__main__':
app.run(host='127.0.0.1', port=8080, debug=True)

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/66ca4b61-9bc2-48b8-9103-9726c03b12bfn%40googlegroups.com.