GAE Launcher (Python) could not start - google-app-engine

I believe this is related a number of python packages I have recently installed environmental variables that I have changed. I have re-installed Numpy and GAE, which did not help. So any suggestions on this? Thanks!
The GAE log indicated that the failure was lined to file import
2013-12-11 11:45:20 Running command: "['C:\\Python27\\pythonw.exe', 'C:\\Program Files (x86)\\Google\\google_appengine\\dev_appserver.py', '--skip_sdk_update_check=yes', '--port=8094', '--admin_port=8004', 'D:\\Dropbox\\ubertool_src']"
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\dev_appserver.py", line 197, in <module>
_run_file(__file__, globals())
File "C:\Program Files (x86)\Google\google_appengine\dev_appserver.py", line 193, in _run_file
execfile(script_path, globals_)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\devappserver2.py", line 27, in <module>
import tempfile
File "C:\Python27\Lib\tempfile.py", line 34, in <module>
from random import Random as _Random
File "C:\Python27\Lib\site-packages\numpy\random\__init__.py", line 102, in <module>
ranf = random = sample = random_sample
NameError: name 'random_sample' is not defined
2013-12-11 11:45:21 (Process exited with code 1)
Update
just did a little test.
I can run from numpy import random
but if I run import random
The error msg is:
>>> import random
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\Lib\site-packages\numpy\random\__init__.py", line 102, in <module>
ranf = random = sample = random_sample
NameError: name 'random_sample' is not defined
Update
The problem is solved after removing C:\Python27\Lib\site-packages\numpy (I am not sure how this was added) from PYTHONPATH in Environmental Variable

Related

I created a virtual environmnt for my new projec, instaled django and started the new project. whnvr I run code with manage.py i get this long error

`when i run line of code: python manage.py startapp blog error below displays
Traceback (most recent call last):
File "C:\Users\lenevo\Desktop\portfolio-project\manage.py", line 22, in <module>
main()
File "C:\Users\lenevo\Desktop\portfolio-project\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\lenevo\Desktop\reemaenv\Lib\site-packages\django\core\management_init_.py", line 381, in execute_from_command_line
utility.execute()
File "C:\Users\lenevo\Desktop\reemaenv\Lib\site-packages\django\core\management_init_.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\lenevo\Desktop\reemaenv\Lib\site-packages\django\core\management\base.py", line 336, in run_from_argv
connections.close_all()
File "C:\Users\lenevo\Desktop\reemaenv\Lib\site-packages\djayour textngo\db\utils.py", line 224, in close_all
connection.close()
File "C:\Users\lenevo\Desktop\reemaenv\Lib\site-packages\django\db\backends\sqlite3\base.py", line 248, in close
if not self.is_in_memory_db():
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\lenevo\Desktop\reemaenv\Lib\site-packages\django\db\backends\sqlite3\base.py", line 367, in is_in_memory_db
return self.creation.is_in_memory_db(self.settings_dict['NAME'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\lenevo\Desktop\reemaenv\Lib\site-packages\django\db\backends\sqlite3\creation.py", line 12, in is_in_memory_db
return database name == ':memory:' or 'mode=memory' in database name
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Type Error: argument of type 'Windows Path' is not Iterable
plz help me solve this problem `

OpenGauss environment installation problem

Traceback (most recent call last):
File "/opt/software/openGauss/script/gspylib/os/gsfile.py", line 31, in <module>
import psutil
File "/opt/software/openGauss/script/gspylib/os/../../../lib/psutil/__init__.py", line 95, in <module>
from . import _pslinux as _psplatform
File "/opt/software/openGauss/script/gspylib/os/../../../lib/psutil/_pslinux.py", line 26, in <module>
from . import _psutil_linux as cext
File "/opt/software/openGauss/script/gspylib/os/../../../lib/psutil/_psutil_linux.py", line 7, in <module>
__bootstrap__()
File "/opt/software/openGauss/script/gspylib/os/../../../lib/psutil/_psutil_linux.py", line 6, in __bootstrap__
imp.load_dynamic(__name__,__file__)
File "/usr/local/python3/lib/python3.7/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /opt/software/openGauss/script/gspylib/os/../../../lib/psutil/_psutil_linux.so: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "gs_preinstall", line 32, in <module>
from gspylib.common.DbClusterInfo import dbClusterInfo, \
File "/opt/software/openGauss/script/gspylib/common/DbClusterInfo.py", line 36, in <module>
from gspylib.os.gsfile import g_file
File "/opt/software/openGauss/script/gspylib/os/gsfile.py", line 65, in <module>
import psutil
File "/opt/software/openGauss/script/gspylib/os/../../../lib/psutil/__init__.py", line 95, in <module>
from . import _pslinux as _psplatform
File "/opt/software/openGauss/script/gspylib/os/../../../lib/psutil/_pslinux.py", line 26, in <module>
from . import _psutil_linux as cext
ImportError: /opt/software/openGauss/script/gspylib/os/../../../lib/psutil/_psutil_linux.so: cannot open shared object file: No such file or directory
The error is that the python dependency cannot be found. Look for the dependency package ‘psutil’

ModuleNotFoundError: No module named 'google.cloud.location'

We have an application that uses firestore. It is running on Python 3.x on standard Google app engine. The application was running fine, till this morning when we tried to run the new version. The deployment of the new version is executed without any error. The requirement.txt is as follows -
firebase_admin==3.0.0
sendgrid==6.9.3
google-auth==1.35.0
google-auth-httplib2==0.1.0
jinja2==3.0.3
MarkupSafe==2.0.1
pytz==2021.3
Flask==2.0.2
twilio==6.46.0
httplib2==0.20.2
requests==2.24.0
requests_toolbelt==0.9.1
google-cloud-tasks==2.7.1
google-cloud-logging==1.15.1
googleapis-common-protos==1.54.0
protobuf==3.20.1
We get the following error.
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/google/cloud/firestore_v1/services/firestore/client.py", line 55, in <module>
from google.cloud.location import locations_pb2 # type: ignore
ModuleNotFoundError: No module named 'google.cloud.location'
Please help.
Updated (9-24-2022) with the complete error output.
Traceback (most recent call last):
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
worker.init_process()
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/gunicorn/workers/gthread.py", line 92, in init_process
super().init_process()
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/gunicorn/workers/base.py", line 134, in init_process
self.load_wsgi()
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
self.wsgi = self.app.wsgi()
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
return self.load_wsgiapp()
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
return util.import_app(self.app_uri)
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/gunicorn/util.py", line 359, in import_app
mod = importlib.import_module(module)
File "/opt/python3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/srv/main.py", line 8, in <module>
from controllers import server, common, header
File "/srv/controllers/server.py", line 19, in <module>
from controllers import basehandler
File "/srv/controllers/basehandler.py", line 12, in <module>
from google.cloud import firestore
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/google/cloud/firestore/__init__.py", line 18, in <module>
from google.cloud.firestore_v1 import __version__
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/google/cloud/firestore_v1/__init__.py", line 36, in <module>
from google.cloud.firestore_v1.async_client import AsyncClient
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/google/cloud/firestore_v1/async_client.py", line 45, in <module>
from google.cloud.firestore_v1.async_transaction import AsyncTransaction
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/google/cloud/firestore_v1/async_transaction.py", line 49, in <module>
from google.cloud.firestore_v1.client import Client
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/google/cloud/firestore_v1/client.py", line 44, in <module>
from google.cloud.firestore_v1.services.firestore import client as firestore_client
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/google/cloud/firestore_v1/services/firestore/__init__.py", line 16, in <module>
from .client import FirestoreClient
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/google/cloud/firestore_v1/services/firestore/client.py", line 55, in <module>
from google.cloud.location import locations_pb2 # type: ignore
ModuleNotFoundError: No module named 'google.cloud.location'
It looks like Google made a mistake in setting requirements for one its Python packages.
If you create a new virtual environment, install with pip install -r you should be able to recreate the error you are seeing in production.
To fix it, I would do pip list on your local machine (in the environment that is still working) and add fixed versions of other installed google packages until it works.
You can test by creating a new Python virtual environment, installing with pip install -r and seeing if it works.
It is a tedious process unfortunately.
I got this exact same error just now while trying to link a Python script to Firestore. I don't know if this is a "correct" solution but I got my code to run and save data to my Firestore database after this doing this.
In the error message, this line specifies the file where google.cloud.location is being imported:
File "/layers/google.python.pip/pip/lib/python3.10/site-packages/google/cloud/firestore_v1/services/firestore/client.py", line 55, in <module>
If you open the client.py file and comment out the line 55 ("from google.cloud.location import locations_pb2 # type: ignore"), then run your code again, the next error message will show the other file where google.cloud.location is being imported. Repeat this process for all five files where this module is imported. (client.py, base.py, grpc.py, grpc_asyncio.py, async_client.py)
From searching through the code, I'm seeing that locations_pb2 (imported from google.cloud.location) is never used. I suspect that commenting this out entirely won't affect the functionality of firebase_admin.

Chromedriver not found in path but I can open in the terminal and ChromeDriverManager gives me and error

I'm new to coding but have been using selenium for chrome in python fine for a few weeks, I don't know what I changed but I am now getting an error message.
I simplified it as much as I can to see what I'm doing wrong, but I can't work it out.
from selenium import webdriver
driver = webdriver.Chrome(r"C:\Users\smim1\PycharmProjects\test\chromedriver.exe")
Error:
Traceback (most recent call last):
File "C:\Users\smim1\PycharmProjects\test\venv\lib\site-packages\selenium\webdriver\common\service.py", line 71, in start
self.process = subprocess.Popen(cmd, env=self.env,
File "C:\Users\smim1\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 832, in __init__
errread, errwrite) = self._get_handles(stdin, stdout, stderr)
File "C:\Users\smim1\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1294, in _get_handles
c2pwrite = msvcrt.get_osfhandle(self._get_devnull())
File "C:\Users\smim1\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1077, in _get_devnull
self._devnull = os.open(os.devnull, os.O_RDWR)
FileNotFoundError: [Errno 2] No such file or directory: 'nul'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\smim1\PycharmProjects\test\test5.py", line 43, in <module>
driver = webdriver.Chrome(service = s)
File "C:\Users\smim1\PycharmProjects\test\venv\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 70, in __init__
super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
File "C:\Users\smim1\PycharmProjects\test\venv\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 90, in __init__
self.service.start()
File "C:\Users\smim1\PycharmProjects\test\venv\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://chromedriver.chromium.org/home
But when I open that file location in the terminal it starts successfully:
PS C:\Users\smim1\PycharmProjects\test> C:\Users\smim1\PycharmProjects\test\chro
medriver.exe
Starting ChromeDriver 101.0.4951.41 (93c720db8323b3ec10d056025ab95c23a31997c9-re
fs/branch-heads/4951#{#904}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggest
ions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
My chrome is the same build:
Chrome is up to date
Version 101.0.4951.54 (Official Build) (64-bit)
I have also tried to move it to the project folder and remove the path but it comes up with the same error
I have tried the webdriver-manager 3.5.4 but get an error:
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
Error:
====== WebDriver manager ======
Traceback (most recent call last):
File "C:\Users\smim1\PycharmProjects\test\test5.py", line 51, in <module>
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
File "C:\Users\smim1\PycharmProjects\test\venv\lib\site-packages\webdriver_manager\chrome.py", line 32, in install
driver_path = self._get_driver_path(self.driver)
File "C:\Users\smim1\PycharmProjects\test\venv\lib\site-packages\webdriver_manager\manager.py", line 19, in _get_driver_path
binary_path = self.driver_cache.find_driver(driver)
File "C:\Users\smim1\PycharmProjects\test\venv\lib\site-packages\webdriver_manager\driver_cache.py", line 74, in find_driver
driver_version = driver.get_version()
File "C:\Users\smim1\PycharmProjects\test\venv\lib\site-packages\webdriver_manager\driver.py", line 39, in get_version
self.get_latest_release_version()
File "C:\Users\smim1\PycharmProjects\test\venv\lib\site-packages\webdriver_manager\driver.py", line 65, in get_latest_release_version
self.browser_version = get_browser_version_from_os(self.chrome_type)
File "C:\Users\smim1\PycharmProjects\test\venv\lib\site-packages\webdriver_manager\utils.py", line 144, in get_browser_version_from_os
OSType.WIN: windows_browser_apps_to_cmd(
File "C:\Users\smim1\PycharmProjects\test\venv\lib\site-packages\webdriver_manager\utils.py", line 125, in windows_browser_apps_to_cmd
powershell = determine_powershell()
File "C:\Users\smim1\PycharmProjects\test\venv\lib\site-packages\webdriver_manager\utils.py", line 245, in determine_powershell
with subprocess.Popen(
File "C:\Users\smim1\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 832, in __init__
errread, errwrite) = self._get_handles(stdin, stdout, stderr)
File "C:\Users\smim1\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1276, in _get_handles
p2cread = msvcrt.get_osfhandle(self._get_devnull())
File "C:\Users\smim1\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1077, in _get_devnull
self._devnull = os.open(os.devnull, os.O_RDWR)
FileNotFoundError: [Errno 2] No such file or directory: 'nul'
I'm sure there is something simple that I am doing wrong but I have tried everything I can find online

How can I fix this error when executing GAE SDK in Ubuntu?

I was following the outlines of this guide (http://www.instructables.com/id/Aquaponics-Online-Temperature-and-Humidity/step3/Testing-GAE-SDK/), so I can try to innovate the design for my own aquaponic system.
However, when I typed "$ python2.7 AppEngine/dev_appserver.py IAquaponics_DHT/myapsystem" into my terminal, I received an error: http://i.imgur.com/ueO4MA1.jpg (my stacktrace is below).
note: "__" is to blank out my name.
____#____-Linux:~$ python2.7 AppEngine/dev_appserver.py
Traceback (most recent call last):
File "AppEngine/dev_appserver.py", line 182, in <module>
_run_file(__file__, globals())
File "AppEngine/dev_appserver.py", line 178, in _run_file
execfile(script_path, globals_)
File "/home/____/AppEngine/google/appengine/tools/devappserver2/devappserver2.py", line 32, in <module>
from google.appengine.tools.devappserver2.admin import admin_server
File "/home/____/AppEngine/google/appengine/tools/devappserver2/admin/admin_server.py", line 25, in <module>
import webapp2
File "/home/____/AppEngine/lib/webapp2-2.5.1/webapp2.py", line 25, in <module>
import webob
File "/home/____/AppEngine/lib/webob-1.2.3/webob/__init__.py", line 3, in <module>
from webob.response import *
File "/home/____/AppEngine/lib/webob-1.2.3/webob/response.py", line 9, in <module>
import zlib
ImportError: No module named zlib
Have you tried (run enter this in the terminal window to install the install a package for zlib)
sudo apt-get install zlib
start there

Resources