volttron.platform.web INFO: Web server not started - python

When I try to run volttron through Eclipse it gives me this message at the end:
volttron.platform.web INFO: Web server not started
In the run configurations, the arguments I gave at first was -vv --developer-mode. It didn't recognize it, neither did it recognise -vv -developer-mode. The message was:
usage: main.py [OPTION]...
main.py: error: unrecognized arguments: --developer-mode
When I remover developer-mode it gives me the first message.
I am using Ubuntu, Luna eclipse.

Developer mode has been removed and is no longer needed.
To achieve the equivalent of the old developer mode do this:
volttron-ctl auth add
Leave ever answer blank except for this:
credentials []: /.*/
This will setup the platform to allow agents to connect without proper credentials which is needed for running an agent in a debugger.
You can find out more here: http://volttron.readthedocs.io/en/develop/devguides/agent_development/index.html
The web server message is just informing you that the VOLTTRON platform web server is not setup to start. This is not an error condition.
Th web server is used for platform discovery, the common agent restful API, and a few other features, none of which required for normal operation.

Related

Run Python Script (On Network Drive) as Windows Service with NSSM

I have followed around 5 tutorials on using NSSM to run a python script residing on a network drive. It creates the service, I can edit the service but when I start the service I get the following error:
Unexpected status SERVICE_STOPPED in response to START control
When I try starting the Windows-10 service from Services I get the following error:
Services error during start
I have changed the path to the python script from the full network path to a mapped network path and that did not change anything.
I have also tried using Task Scheduler which worked once in a while and was intermittent and I also tried the pywin32 method as posted here but it fails to start the service as well.
I figured it out. On my remote VM it does not allow Local System Account to be set as the Log on. It required me to add an admin user name and password. It's running now.

Can't remote debug a Python web site in Azure with vs2013

I deployed a bottle website on Azure but it shows 500 (internal error) and I can’t see the log. I refer to https://github.com/Microsoft/PTVS/wiki/Azure-Remote-Debugging to debug my project but it failed.
It shows the error message as below.
could not attach to python.exe process on Azure web site at testpybottleapp.azurewebsites.net.
Error retrieving websocket debug proxy information from web.config.
And when I try to open http://testpybottleapp.azurewebsites.net/ptvsd it said ptvsd not existed.
Have you considered using VorlonJS as well? It's a remote website debugger which may help in this case.
Alternatively, could you try grabbing a similar VM from VMDepot, uploading that, and seeing if you have the same issue? That could help us troubleshoot and understand if the issue lies in the VM itself, or one of the configuration settings.
If we want to use the remote debug on Azure for python website, we should set the publish mode as "debug". And then we should enable websocket.
Meanwhile I suggest you can try to use the debug=>Attach to Process and input wss://WSGI_PTVSD_SECRET#WEBSITE_NAME.azurewebsites.net/ptvsd. When the process (Python.exe) is shown,you can click the "Attach". Then you can open your website http://WEBSITE_NAME.azurewebsites.net in browser.
If you visit the URL like "http://mysite.azurewebsites.net/ptvsd" and get the "ptvsd not existed" error, Please double check these points:
You should publish your website as Debug mode not release mode.
Make sure the 'WSGI_PTVSD_SECRET' in local is same as the Azure website .

How to watch activity in production environment like ./manage.py runserver?

In a local testing environment, python manage.py runserver is like this wonderful all-seeing-eye for activity in your development and page requests.
But in the actual server environment it's a black box - you can't see much of anything or diagnose issues.
How do you get an interface such as in manage.py runserver in a live environment?
Server Logs
Mostly, server logs typically replace the stream of information in the console.
You can set up logging here: https://docs.djangoproject.com/en/1.8/topics/logging/
Django exception email
With DEBUG off, and settings.ADMINS set, you will automatically receive a full traceback debug email every time there's an exception.
Runserver
You can also still run runserver on production environments, then hit the URL via CURL or other to say drop into pdb if it's an app issue.
Error monitoring tools
There are other tools, such as sentry https://github.com/getsentry/sentry which is a joy to use and debug issues. It takes exceptions and sends them to a multi platform (even frontend/JS exceptions) exception monitoring tool and draws lots of useful exception data.
Newrelic is another application monitoring tool that would automatically track exceptions with full tracebacks.
Brute force
You can always write to files with only a few lines of python without relying on any major tools:
with open('some-file.txt', 'a') as f:
f.write('foobar\n')

invalid client error from YouTube Analytics API

Original
I am trying to get top 10 videos in my channel from YouTube, so I followed the sample code from Google: https://developers.google.com/youtube/analytics/v1/code_samples/python#retrieve_top_10_videos_by_viewcount
I have installed all packages and downloaded client secrets. I typed python get_json.py in command line. (The sample script is renamed to get_json.py) This is what is showing up in command line:
WARNING:root:This function, oauth2client.tools.run(), and the use of the gflags library are deprecated and will be removed in a future version of the library.
Your browser has been opened to visit:
https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fyoutube.readonly+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fyt-analytics.readonly&
redirect_uri=http%3A%2F%2Flocalhost%3A8080%2F&response_type=code&client_id=849986408789-otj3v9ghdlrr24nag9c4bepei6fo0vvm.apps.googleusercontent.com&access_type=offline
If your browser is on a different machine then exit and re-run this application with the command-line parameter
--noauth_local_webserver
Then my browser pops up and I am getting this invalid_client error. Did I miss anything?
Update
I added a name in "product name" in Google API Console and reset my client secret. It works now.
It seems like you set your credentials in Google Developer Console wrong. If you are running it from a local machine, you should pick "installed application" or if from a webserver, you should specify the redirect_uri.
Also make sure YT Analytics API is turned on in the console for this project.

PyDev interactive console

When trying to open a interactive console on pydev I get an error:
Error initializing console.
Unexpected error connecting to console.
Failed to recive suitable Hello response from pydevconsole. Last msg
received: HTTP server returned unexpected status: Service Unavailable
Command Line used: D:\activestate\python.exe -u
D:\Boulot\pydev\eclipse\plugins\org.python.pydev_3.3.3.201401272249\pysrc\pydevconsole.py
51203 51204 51203 51204
Eclipse:
Version: Kepler Service Release 2
Build id: 20140224-0627
Pydev:
PyDev for Eclipse 3.3.3.201401272249
Java:
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
Any idea how to make it work?
Try following:
In Eclipse under Window/Preferences/General/Network Connections:
--> set Active Provider: Manual
--> check in the box "Proxy bypass" if localhost and 127.0.0.1 are checked
Click Apply and try to open again.
That worked for me
As documented here, the solution is to update IPython
workon project
pip install -U ipython
I was having the same problem and fixed it with this.
(My solution is inspired by #Sala's answer. And I want to add more reasoning here.)
The root cause for my problem is, pydev console is hosted on localhost/127.0.0.1 and I have configured a proxy in my system. So my eclipse tried to visit it via a proxy but my proxy cannot find it since it is not a valid public address.
With #Sala's solution, one working configuration is like below. It essentially prevents eclipse from using the system (i.e. native) proxy.
And you should notice that in the Proxy bypass area, the Provider for localhost and 127.0.0.1 is Manual. Just in consistent with the Proxy entries area.
But what if you do want to use proxy? You need to bypass your native proxy for pydev console.
You can do it in IE -> Internet Options -> Connection -> LAN Settings -> Advanced:
Then, you don't nee to restart your eclipse, and you will see the Provider for the bypassed localhost and 127.0.0.1 has changed to Native now as shown below:
Now the pydev console should be able to start.

Categories