I'm trying to test gae-boilerplate locally, but when I try to create a new account the following error appears.
The strange thing is that if I open python interpreter and type "import pwd" it works.
Internal Server Error
The server has either erred or is incapable of performing the requested operation.
Traceback (most recent call last): File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1535, in __call__
rv = self.handle_exception(request, response, e) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1529, in __call__
rv = self.router.dispatch(request, response) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher
return route.handler_adapter(request, response) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1102, in __call__
return handler.dispatch() File "/Users/moisesguimaraes/workspaces/python/mtgtradelist/boilerplate/lib/basehandler.py", line 88, in dispatch
webapp2.RequestHandler.dispatch(self) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 572, in dispatch
return self.handle_exception(e, self.app.debug) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 570, in dispatch
return method(*args, **kwargs) File "/Users/moisesguimaraes/workspaces/python/mtgtradelist/boilerplate/handlers.py", line 766, in post
password = utils.hashing(password, self.app.config.get('salt')) File "/Users/moisesguimaraes/workspaces/python/mtgtradelist/boilerplate/lib/utils.py", line 38, in hashing
from Crypto.Cipher import AES File "/Library/Python/2.7/site-packages/pycrypto-2.6-py2.7-macosx-10.8-intel.egg/Crypto/Cipher/AES.py", line 50, in <module> File "/Library/Python/2.7/site-packages/pycrypto-2.6-py2.7-macosx-10.8-intel.egg/Crypto/Cipher/_AES.py", line 7, in <module> File "/Library/Python/2.7/site-packages/pycrypto-2.6-py2.7-macosx-10.8-intel.egg/Crypto/Cipher/_AES.py", line 4, in __bootstrap__ File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/setuptools-0.6c11/pkg_resources.py", line 882, in resource_filename
self, resource_name File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/setuptools-0.6c11/pkg_resources.py", line 1351, in get_resource_filename
self._extract_resource(manager, self._eager_to_zip(name)) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/setuptools-0.6c11/pkg_resources.py", line 1373, in _extract_resource
self.egg_name, self._parts(zip_path) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/setuptools-0.6c11/pkg_resources.py", line 957, in get_cache_path
extract_path = self.extraction_path or get_default_cache() File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/setuptools-0.6c11/pkg_resources.py", line 1080, in get_default_cache
return os.path.expanduser('~/.python-eggs') File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 259, in expanduser
import pwd File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/python/sandbox.py", line 835, in load_module
raise ImportError('No module named %s' % fullname) ImportError: No module named pwd
I believe this problem was introduced by an AppEngine SDK update. I'm currently using version 1.8.6. The gae-boilerplate README states that its been "Tested with SDK version 1.8.1"
I was able to run it locally by running old_dev_appserver.py <application root> old_dev_appserver.py is provided by the SDK and is located in the same directory as dev_appserver.py.
Based on the traceback I got, it looks like the file boilerplate/external/requests/utils.py imports netrc which imports pwd.
The newer version of the SDK doesn't allow you to import the pwd module in its sandbox mode.
You probably installed pycrypto with easy_install. If you reinstalling it with pip instead, everything should work:
pip uninstall pycrypto
pip install pycrypto
Note, pip uninstall works even though it was installed with easy_install. You also might need to use sudo.
If you don't have pip, install it like this:
sudo easy_install pip
Related
pip install clipboard
ERROR: Exception:
Traceback (most recent call last):
File "C:\Users\amin_\AppData\Roaming\Python\Python310\site-packages\pip\_internal\cli\base_command.py", line 167, in exc_logging_wrapper
status = run_func(*args)
File "C:\Users\amin_\AppData\Roaming\Python\Python310\site-packages\pip\_internal\cli\req_command.py", line 205, in wrapper
return func(self, options, args)
File "C:\Users\amin_\AppData\Roaming\Python\Python310\site-packages\pip\_internal\commands\install.py", line 287, in run
session = self.get_default_session(options)
File "C:\Users\amin_\AppData\Roaming\Python\Python310\site-packages\pip\_internal\cli\req_command.py", line 75, in get_default_session
self._session = self.enter_context(self._build_session(options))
File "C:\Users\amin_\AppData\Roaming\Python\Python310\site-packages\pip\_internal\cli\req_command.py", line 89, in _build_session
session = PipSession(
File "C:\Users\amin_\AppData\Roaming\Python\Python310\site-packages\pip\_internal\network\session.py", line 282, in __init__
self.headers["User-Agent"] = user_agent()
File "C:\Users\amin_\AppData\Roaming\Python\Python310\site-packages\pip\_internal\network\session.py", line 157, in user_agent
setuptools_dist = get_default_environment().get_distribution("setuptools")
File "C:\Users\amin_\AppData\Roaming\Python\Python310\site-packages\pip\_internal\metadata\__init__.py", line 75, in get_default_environment
return select_backend().Environment.default()
File "C:\Users\amin_\AppData\Roaming\Python\Python310\site-packages\pip\_internal\metadata\__init__.py", line 63, in select_backend
from . import pkg_resources
File "C:\Users\amin_\AppData\Roaming\Python\Python310\site-packages\pip\_internal\metadata\pkg_resources.py", line 8, in <module>
from pip._vendor import pkg_resources
File "C:\Users\amin_\AppData\Roaming\Python\Python310\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3252, in <module>
def _initialize_master_working_set():
File "C:\Users\amin_\AppData\Roaming\Python\Python310\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3235, in _call_aside
f(*args, **kwargs)
File "C:\Users\amin_\AppData\Roaming\Python\Python310\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3277, in _initialize_master_working_set
tuple(
File "C:\Users\amin_\AppData\Roaming\Python\Python310\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3278, in <genexpr>
dist.activate(replace=False)
File "C:\Users\amin_\AppData\Roaming\Python\Python310\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2785, in activate
declare_namespace(pkg)
File "C:\Users\amin_\AppData\Roaming\Python\Python310\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2284, in declare_namespace
_handle_ns(packageName, path_item)
File "C:\Users\amin_\AppData\Roaming\Python\Python310\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2217, in _handle_ns
loader.load_module(packageName)
File "C:\Users\amin_\AppData\Roaming\Python\Python310\site-packages\pygoogle\google.py", line 113
print """PyGoogle %(__version__)s
^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
WARNING: There was an error checking the latest version of pip.
I suggest you can use pyperclip as it is the same a s clipboard and it is newer.
https://pypi.org/project/pyperclip/
import pyperclip
>>> pyperclip.copy('The text to be copied to the clipboard.')
>>> pyperclip.paste()
'The text to be copied to the clipboard.'
Currently only handles plaintext.
On Windows, no additional modules are needed.
On Mac, this module makes use of the pbcopy and pbpaste commands, which should come with the os.
On Linux, this module makes use of the xclip or xsel commands, which should come with the os. Otherwise run “sudo apt-get install xclip” or “sudo apt-get install xsel” (Note: xsel does not always seem to work.)
Otherwise on Linux, you will need the gtk or PyQt4 modules installed.
I hope this help. :)
I'm trying to do the Flask "Hello World" tutorial and when I do the 'flask run' command on terminal I get the following traceback:
PS C:\Users\boymeetscode\PycharmProjects\beerRPG> flask run
Traceback (most recent call last):
File "C:\Users\boymeetscode\miniconda3\envs\beerRPG\Scripts\flask-script.py", line 9, in <module>
sys.exit(main())
File "C:\Users\boymeetscode\miniconda3\envs\beerRPG\lib\site-packages\flask\cli.py", line 990, in main
cli.main(args=sys.argv[1:])
File "C:\Users\boymeetscode\miniconda3\envs\beerRPG\lib\site-packages\flask\cli.py", line 596, in main
return super().main(*args, **kwargs)
File "C:\Users\boymeetscode\miniconda3\envs\beerRPG\lib\site-packages\click\core.py", line 1062, in main
rv = self.invoke(ctx)
File "C:\Users\boymeetscode\miniconda3\envs\beerRPG\lib\site-packages\click\core.py", line 1668, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\boymeetscode\miniconda3\envs\beerRPG\lib\site-packages\click\core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\boymeetscode\miniconda3\envs\beerRPG\lib\site-packages\click\core.py", line 763, in invoke
return __callback(*args, **kwargs)
File "C:\Users\boymeetscode\miniconda3\envs\beerRPG\lib\site-packages\click\decorators.py", line 84, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "C:\Users\boymeetscode\miniconda3\envs\beerRPG\lib\site-packages\click\core.py", line 763, in invoke
return __callback(*args, **kwargs)
File "C:\Users\boymeetscode\miniconda3\envs\beerRPG\lib\site-packages\flask\cli.py", line 844, in run_command
show_server_banner(get_env(), debug, info.app_import_path, eager_loading)
File "C:\Users\boymeetscode\miniconda3\envs\beerRPG\lib\site-packages\flask\cli.py", line 678, in show_server_banner
click.echo(f" * Environment: {env}")
File "C:\Users\boymeetscode\miniconda3\envs\beerRPG\lib\site-packages\click\utils.py", line 294, in echo
file = auto_wrap_for_ansi(file) # type: ignore
File "C:\Users\boymeetscode\miniconda3\envs\beerRPG\lib\site-packages\click\_compat.py", line 541, in auto_wrap_for_ansi
import colorama
ModuleNotFoundError: No module named 'colorama'
I am on Windows, Python 3.9.7 and did the pip install flask in my venv so if colorama is a dependency I would expect that it would have been installed automatically. Why isn't it?
Update: I manually installed colorama and now Flask works. I'm just still confused why if this is a dependency it wasn't installed automatically. My pip install didn't appear to return any errors.
Can confirm something in conda or click broke recently: colorama is missing after installing click (which was installed for black in my case). I use conda environment files so instead of manually installing I added a more recent version with
- conda-forge::click
in the .yml file.
Then conda update installed click 8.03 and colorama, over click 8.0.1 which I had. Without an env file conda install -c conda-forge click should do the trick.
I do not know what exactly fixed it though, it is not in click's release notes: though there was arecent change to always install colorama, that was in version 8.0.0.
I moved my python project from a native Linux installation to Windows and I tried to run pipenv custom scripts through WSL 2 on Windows 10 using pipenv run my_script.
Although the same command works in a native Ubuntu installation, on WSL 2 (Ubuntu 20.04) I get an Attribute error in the shlex module regarding the instream object not having attribute read.
My [scripts] section in the Pipfile looks like this, but I've also tried running python scripts (instead of shell ones) and the error can be reproduced with any custom script.
[scripts]
build = "bash ./scripts/main.sh -b"
analyze = "bash ./scripts/main.sh -a"
I've also tried to update the pipenv package but looks like I'm running the latest version (11.9.0, pipenv-2020.6.2).
My code doesn't seem to run at all since I get an error before the arguments are passed to the custom script. This is the stacktrace I get from running the command:
Traceback (most recent call last):
File "/usr/bin/pipenv", line 11, in <module>
load_entry_point('pipenv==11.9.0', 'console_scripts', 'pipenv')()
File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/lib/python3/dist-packages/pipenv/cli.py", line 602, in run
core.do_run(command=command, args=args, three=three, python=python)
File "/usr/lib/python3/dist-packages/pipenv/core.py", line 2200, in do_run
command = ' '.join(project.scripts[command])
File "/usr/lib/python3/dist-packages/pipenv/project.py", line 374, in scripts
scripts[k] = shlex.split(v, posix=True)
File "/usr/lib/python3.8/shlex.py", line 311, in split
return list(lex)
File "/usr/lib/python3.8/shlex.py", line 300, in __next__
token = self.get_token()
File "/usr/lib/python3.8/shlex.py", line 109, in get_token
raw = self.read_token()
File "/usr/lib/python3.8/shlex.py", line 140, in read_token
nextchar = self.instream.read(1)
AttributeError: 'list' object has no attribute 'read'
I am trying to run Scrapy and encountering the following error.
It seems that Scrapy can't find TheTwisted 10.0.0 - I've downloaded it but don't know where to place the folder. Thanks!
Traceback (most recent call last):
File "/usr/local/bin/scrapy", line 5, in
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/init.py", line 3095, in
#_call_aside
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/init.py", line 3081, in _call_aside
f(*args, **kwargs)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/init.py", line 3108, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/init.py", line 658, in _build_master
ws.require(requires)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/init.py", line 959, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/init.py", line 846, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'Twisted>=10.0.0' distribution was not found and is required by Scrapy
If using Linux, install Twisted by running pip install Twisted in terminal.
If Windows, the Twisted docs recommend pip install Twisted[windows_platform].
In both cases if you're using a virtual environment (recommended) make sure to install it inside the venv.
This image will help you to find the issue I have configured Openstack newton on ubunu 16.04 LTS. It works fine
Now i have planned to integrate Murano in to this.
All progressed fine..When i am running dashboard using "tox -e venv -- python manage.py runserver <IP:PORT>" command. I am able to run the murano dashboard.
When i am accessing environment tab it displaying error
Error: There was an error communicating with server.
And log message displays an error
No module named memcache
For your reference error message below:
Traceback (most recent call last):
File "/root/murano/murano/murano/api/middleware/fault.py", line 130, in
process_request
return req.get_response(self.application)
File "/root/murano/murano/.tox/venv/local/lib/python2.7/site-packages/webob/request.py",
line 1299, in send
application, catch_exc_info=False)
File "/root/murano/murano/.tox/venv/local/lib/python2.7/site-packages/webob/request.py",
line 1263, in call_application
app_iter = application(self.environ,
start_response)
File "/root/murano/murano/.tox/venv/local/lib/python2.7/site-packages/webob/dec.py",
line 130, in __call__
resp = self.call_func(req, *args,
**self.kwargs)
File "/root/murano/murano/.tox/venv/local/lib/python2.7/site-packages/webob/dec.py",
line 195, in call_func
return self.func(req, *args, **kwargs)
File "/root/murano/murano/.tox/venv/local/lib/python2.7/site-packages/keystonemiddleware/auth_token/__init__.py",
line 320, in __call__
response = self.process_request(req)
File "/root/murano/murano/.tox/venv/local/lib/python2.7/site-packages/keystonemiddleware/auth_token/__init__.py",
line 552, in process_request
resp = super(AuthProtocol,
self).process_request(request)
File "/root/murano/murano/.tox/venv/local/lib/python2.7/site-packages/keystonemiddleware/auth_token/__init__.py",
line 348, in process_request
data, user_auth_ref =
self._do_fetch_token(request.user_token)
File "/root/murano/murano/.tox/venv/local/lib/python2.7/site-packages/keystonemiddleware/auth_token/__init__.py",
line 388, in _do_fetch_token
data = self.fetch_token(token)
File "/root/murano/murano/.tox/venv/local/lib/python2.7/site-packages/keystonemiddleware/auth_token/__init__.py",
line 661, in fetch_token
cached =
self._cache_get_hashes(token_hashes)
File "/root/murano/murano/.tox/venv/local/lib/python2.7/site-packages/keystonemiddleware/auth_token/__init__.py",
line 644, in _cache_get_hashes
cached =
self._token_cache.get(token)
File "/root/murano/murano/.tox/venv/local/lib/python2.7/site-packages/keystonemiddleware/auth_token/_cache.py",
line 214, in get
with self._cache_pool.reserve() as cache:
File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
return self.gen.next()
File "/root/murano/murano/.tox/venv/local/lib/python2.7/site-packages/keystonemiddleware/auth_token/_cache.py",
line 78, in reserve
import memcache
ImportError: No module named memcache
Can someone help on this?
Thanks in Advance.
Just installing memcached is not enough. You will also need to install python memcache module which is provided separately by python-memcache and python-pymemcache. I am not sure which one is used here.
You can try installing them with apt-get and see which one works for you.
Now working.. I have installed murano api and murano dashboard in different venv.
I have missed to install memcache in munano api venv. When i'm tried after install memcache in murano api venv..Now working fine..
#tutuDajuju Thanks for the Help...