I'm trying to configure newrelic with zope but it is returning the error:
# bin/newrelic-admin run-python bin/zeoserver fg
Traceback (most recent call last):
File "bin/zeoserver", line 22, in <module>
import plone.recipe.zeoserver.ctl
File "/opt/bitnami/apps/plone/buildout-cache/eggs/plone.recipe.zeoserver-1.2.6-py2.7.egg/plone/recipe/zeoserver/__init__.py", line 9, in <module>
import zc.recipe.egg
File "/opt/bitnami/apps/plone/buildout-cache/eggs/zc.recipe.egg-1.3.2-py2.7.egg/zc/recipe/egg/__init__.py", line 1, in <module>
from zc.recipe.egg.egg import Egg, Scripts, Eggs
File "/opt/bitnami/apps/plone/buildout-cache/eggs/zc.recipe.egg-1.3.2-py2.7.egg/zc/recipe/egg/egg.py", line 21, in <module>
import zc.buildout.easy_install
File "/opt/bitnami/apps/plone/buildout-cache/eggs/zc.buildout-2.2.5-py2.7.egg/zc/buildout/easy_install.py", line 81, in <module>
pkg_resources.Requirement.parse('zc.buildout')).location,
AttributeError: 'NoneType' object has no attribute 'location'
Does anyone know what can it be pls?
I solved adding the below code in a __init__.py from application:
import newrelic.agent
newrelic.agent.initialize('path/of/newrelic.ini')
And execute the application without the command "newrelic-admin run-python".
Newrelic worked but with limitations because don't have official support yet.
Related
I'm trying to run my Django application, which used to work fine before. Now, it is showing this strange error, which seems like coming from Django.
Django Version: 4.1
Python Version: 3.10.6 (Docker Image python:3.10.6)
django shell commands
Traceback (most recent call last):
File "/srv/project/./manage.py", line 9, in <module>
from django.core.management import execute_from_command_line
File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 16, in <module>
from django.apps import apps
File "/usr/local/lib/python3.10/site-packages/django/apps/__init__.py", line 1, in <module>
File "/usr/local/lib/python3.10/site-packages/django/apps/config.py", line 13, in <module>
File "/usr/local/lib/python3.10/site-packages/django/apps/config.py", line 62, in AppConfig
File "/usr/local/lib/python3.10/site-packages/django/utils/functional.py", line 27, in __init__
from django.utils.deprecation import RemovedInDjango50Warning
File "/usr/local/lib/python3.10/site-packages/django/utils/deprecation.py", line 5, in <module>
from asgiref.sync import sync_to_async
ValueError: source code string cannot contain null bytes
I'm following along a course - Django development to deployment.
After pulling it to Digital Ocean everything else ran smoothly. Until
I tried running python manage.py help
(env) djangoadmin#ubuntu-1:~/pyapps/btre_project_4$ python manage.py help
and I get this error.
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/home/djangoadmin/pyapps/env/lib/python3.5/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/home/djangoadmin/pyapps/env/lib/python3.5/site-packages/django/core/management/__init__.py", line 377, in execute
django.setup()
File "/home/djangoadmin/pyapps/env/lib/python3.5/site-packages/django/__init__.py", line 16, in setup
from django.urls import set_script_prefix
File "/home/djangoadmin/pyapps/env/lib/python3.5/site-packages/django/urls/__init__.py", line 1, in <module>
from .base import (
File "/home/djangoadmin/pyapps/env/lib/python3.5/site-packages/django/urls/base.py", line 9, in <module>
from .exceptions import NoReverseMatch, Resolver404
File "/home/djangoadmin/pyapps/env/lib/python3.5/site-packages/django/urls/exceptions.py", line 1, in <module>
from django.http import Http404
File "/home/djangoadmin/pyapps/env/lib/python3.5/site-packages/django/http/__init__.py", line 2, in <module>
from django.http.request import (
File "/home/djangoadmin/pyapps/env/lib/python3.5/site-packages/django/http/request.py", line 10, in <module>
from django.core import signing
File "/home/djangoadmin/pyapps/env/lib/python3.5/site-packages/django/core/signing.py", line 45, in <module>
from django.utils.crypto import constant_time_compare, salted_hmac
File "/home/djangoadmin/pyapps/env/lib/python3.5/site-packages/django/utils/crypto.py", line 6, in <module>
import secrets
ImportError: No module named 'secrets'
I'm a newbie and have been stuck on this for a while. I just want to know what could possibly cause this.
The secrets module was added to Python in version 3.6. Your host is using Python 3.5, hence the secrets module is unavailable. You need a host with Python 3.6+, or a version of Django that doesn't depend on the secrets module
Had the same issue, solved it by specifying the python version I have installed. i.e
$ python3
>>> import secrets
>>> secrets.token_hex(16)
I am running into an error when importing the below library
from google.cloud import vision
The error message I receive is :
Traceback (most recent call last):
File "d:/UnmatchedOTMProcess/ImageDetection_test.py", line 2, in <module>
from google.cloud import vision
File "C:\Users\mhancock\AppData\Roaming\Python\Python38\site-packages\google\cloud\vision.py", line
17, in <module>
from google.cloud.vision_v1 import ImageAnnotatorClient
File "C:\Users\mhancock\AppData\Roaming\Python\Python38\site-
packages\google\cloud\vision_v1\__init__.py", line 27, in <module>
from google.cloud.vision_v1.gapic import image_annotator_client as iac
File "C:\Users\mhancock\AppData\Roaming\Python\Python38\site-
packages\google\cloud\vision_v1\gapic\image_annotator_client.py", line 24, in <module>
import google.api_core.gapic_v1.client_info
File "C:\Users\mhancock\AppData\Roaming\Python\Python38\site-
packages\google\api_core\gapic_v1\__init__.py", line 16, in <module>
from google.api_core.gapic_v1 import config
File "C:\Users\mhancock\AppData\Roaming\Python\Python38\site-
packages\google\api_core\gapic_v1\config.py", line 23, in <module>
import grpc
File "C:\Users\mhancock\AppData\Roaming\Python\Python38\site-packages\grpc\__init__.py", line 23, in
<module>
from grpc._cython import cygrpc as _cygrpc
ImportError: cannot import name 'cygrpc' from 'grpc._cython'
(C:\Users\mhancock\AppData\Roaming\Python\Python38\site-packages\grpc\_cython\__init__.py)
The code works perfectly on my local machine, however trying to run this on a gcp virtual machine and the environment must be slightly different somehow.
Appreciate any assistance!
Thanks in advance,
Matt
Has anyone tried using newspaper3k python library on AWS Elastic Beanstalk Python 3.4?
I'm getting a strange error, despite images.py existing in the newspaper directory.
Traceback (most recent call last):
File "/opt/python/current/app/application.py", line 12, in <module>
from server.helper import get_connection, requires_auth, validate_schema, error_handler
File "/opt/python/current/app/server/helper.py", line 13, in <module>
from database.user import User
File "/opt/python/current/app/database/user.py", line 11, in <module>
from .post import Post
File "/opt/python/current/app/database/post.py", line 9, in <module>
from newspaper import Article
File "/opt/python/run/venv/lib/python3.4/site-packages/newspaper/__init__.py", line 10,in <module>
from .api import (build, build_article, fulltext, hot, languages,
File "/opt/python/run/venv/lib/python3.4/site-packages/newspaper/api.py", line 14, in <module>
from .article import Article
File "/opt/python/run/venv/lib/python3.4/site-packages/newspaper/article.py", line 14, in <module>
from . import images
ImportError: cannot import name 'images'
I have installed all dependencies (Pillow, lxml, libjpeg etc.) correctly and surprisingly when I ssh to instance it works properly.
Any help would be appreciated, thanks!
I have successfully installed cherrypy but when I try to import it, I get following error. I am a newbie and have spent quite a bit of time trying to get this to work, so any help would be highly appreciated.
Traceback (most recent call last):
File "unitconverter.py", line 1, in <module>
import cherrypy
File "c:\Python34\lib\site-packages\cherrypy-3.2.0-py3.4.egg\cherrypy\__init__
.py", line 82, in <module>
from cherrypy import process
File "c:\Python34\lib\site-packages\cherrypy-3.2.0-py3.4.egg\cherrypy\process\
__init__.py", line 14, in <module>
from cherrypy.process import plugins, servers
File "c:\Python34\lib\site-packages\cherrypy-3.2.0-py3.4.egg\cherrypy\process\
plugins.py", line 424, in <module>
class PerpetualTimer(threading._Timer):
AttributeError: 'module' object has no attribute '_Timer'
From what I can see, it's a bug with that version of CherryPy. You'd be best upgrading to a more recent version instead.