Running Into Issues Access Console On Google Appengine 1.5.4 - python

I'm running into the following issue when trying to activate our console on Google Appengine.
WARNING:root:No ssl package found. urlfetch will not be able to validate SSL certificates.
Traceback (most recent call last):
File "manage.py", line 18, in
InstallAppengineHelperForDjango()
File "/Users/franklinkho/Workspace/mopub/server/appengine_django/init.py", line 550, in InstallAppengineHelperForDjango
LoadAppengineEnvironment()
File "/Users/franklinkho/Workspace/mopub/server/appengine_django/init.py", line 212, in LoadAppengineEnvironment
appconfig, unused_matcher, _ = dev_appserver.LoadAppConfig(PARENT_DIR, {})
ValueError: need more than 2 values to unpack
Does anyone know why this is occurring?

So this is an issue with your version of GAE, its trying to unpack more values than is there. The patch is to set the retun of LoadAppConfig to be two parameters, the first is the appconfig and the other you can disregard.
appconfig, unused_matcher = dev_appserver.LoadAppConfig(PARENT_DIR, {})

Related

Connect Python to Bonsai

I am trying to connect to Bonsai using Python and for this I am using the code provided by Bonsai here. However, my code breaks at
bonsai = os.environ['https://username:password#app-testing-3106893156.eu-central-1.bonsaisearch.net:443']
with error
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/usr/lib/python3.7/os.py", line 679, in __getitem__
raise KeyError(key) from None
KeyError: 'https://username:password#app-testing-3106893156.eu-central-1.bonsaisearch.net:443'
I am using the exact same code Bonsai provides and I am only adding the Full Access URL also provided by Bonsai so I have no idea how to proceed with this. Any ideas what is causing the error?
You have to set environment variable first. example
export BONSAI_URL='https://username:password#app-testing-3106893156.eu-central-1.bonsaisearch.net:443'
and then use it in code like
bonsai = os.environ['BONSAI_URL']
Check How to set environment variables in Python

TypeError: initial_value must be unicode or None, not str,

I am using SOAPpy for soap wsdl services. I am following this toturail. My code is as follow
from SOAPpy import WSDL
wsdlfile = 'http://track.tcs.com.pk/trackingaccount/track.asmx?WSDL'
server = WSDL.Proxy(wsdlfile)
I am getting this error on the last line of my code
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/adil/Code/mezino/RoyalTag/royalenv/local/lib/python2.7/site-packages/SOAPpy/WSDL.py", line 85, in __init__
self.wsdl = reader.loadFromString(str(wsdlsource))
File "/home/adil/Code/mezino/RoyalTag/royalenv/local/lib/python2.7/site-packages/wstools/WSDLTools.py", line 52, in loadFromString
return self.loadFromStream(StringIO(data))
TypeError: initial_value must be unicode or None, not str
I tried to convert the string into utf using
wsdlFile = unicode('http://track.tcs.com.pk/trackingaccount/track.asmx?WSDL, "utf-8")
but still having same error. What is missing here ?
I just ran into this problem with some very old 2.7 code that no longer worked due to the TLS update. After updating to the most recent version of Python 2 I ended up getting this issue.
I was only able to fix this by setting up a new virtual environment, then modifying the wstools package in that virtual environment to use BytesIO instead of StringIO.
Replace every required instance of StringIO. For example:
# WSDLTools.py
...
from IO import BytesIO
...
return self.loadFromStream(BytesIO(data))
Not ideal, but it worked. Easier than migrating everything to Python 3...

jirashell throws a "KeyError: u'consumer_key'" and does not start

I am new to jira-python and have run into an issue with using jirashell.
jira-python was installed from documentation given here: http://jira.readthedocs.org/en/latest/
When I try to start jirashell using:
ubuntu#ip-10-0-0-12:~$ jirashell -s https://jira.atlassian.com
I get the following error:
Traceback (most recent call last):
File "/usr/local/bin/jirashell", line 11, in <module> sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/jira/jirashell.py", line 248, in main
jira = JIRA(options=options, basic_auth=basic_auth, oauth=oauth)
File "/usr/local/lib/python2.7/dist-packages/jira/client.py", line 202, in __init__self._create_oauth_session(oauth)
File "/usr/local/lib/python2.7/dist-packages/jira/client.py", line 1871, in _create_oauth_session
oauth['consumer_key'],
KeyError: u'consumer_key'
I have also tried to get to a server using basic auth but that returns the same error. Using curl works fine, but I wanted to see the objects that are getting returned and get help as I develop by python-jira integration.
Thank you for any insight.

VirtualBox Python API - remote access

I'm trying to run virtual machine set on Computer with Windows 7 (my main laptop) from my netbook (Ubuntu system).
On Ubuntu I've prepared python script:
from vboxapi import VirtualBoxManager
import sys
sys.path.append("/home/myLogin/Downloads/sdk/bindings/webservice/python/lib")
mgr = VirtualBoxManager("WEBSERVICE", {'url':'myIP', 'user':'myServerLogin', 'password':'myPassthere'})
vbox = mgr.vbox
name = "Muszelek"
mach = vbox.findMachine(name)
session = mgr.mgr.getSessionObject(vbox)
progress = mach.launchVMProcess(session, "gui", "")
progress.waitForCompletion(-1)
mgr.closeMachineSession(session)
I'm getting error:
Installation problem: check that appropriate libs in place
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/vboxapi/__init__.py", line 981, in __init__
self.vbox = self.platform.getVirtualBox()
File "/usr/local/lib/python2.7/dist-packages/vboxapi/__init__.py", line 856, in getVirtualBox
return self.connect(self.url, self.user, self.password)
File "/usr/local/lib/python2.7/dist-packages/vboxapi/__init__.py", line 910, in connect
self.vbox = self.wsmgr.logon(self.user, self.password)
File "/home/karolinka/Downloads/sdk/bindings/webservice/python/lib/VirtualBox_wrappers.py", line 11790, in logon
req=IWebsessionManager_logonRequestMsg()
NameError: global name 'IWebsessionManager_logonRequestMsg' is not defined
Traceback (most recent call last):
File "vmmach.py", line 5, in <module>
mgr = VirtualBoxManager("WEBSERVICE", {'url':'myIP', 'user':'myComputerLogin', 'password':'myPass'})
File "/usr/local/lib/python2.7/dist-packages/vboxapi/__init__.py", line 985, in __init__
raise ne
NameError: global name 'IWebsessionManager_logonRequestMsg' is not defined
Any idea how could I solve this issue?
Is it problem with libs on my Windows Machine?
I just had the exact same problem on my Mac. The issue is that VirtualBox_wrappers.py imports VirtualBox_client.py (which defines the global name in question) in a try block and continues (pass) if it can not be imported
try:
from VirtualBox_client import *
except:
pass
the issue is that VirtualBox_client.py depends on ZSI, which was not installed, so the import failed. Once I did
easy_install zsi
everything worked as expected.
It seems that the class is not found! Have you tried to look for the webservice api if they are available?
I had a similar issue, I looked in /usr/lib/virtualbox/sdk/bindings and I didn't find the webservice folder only xpcom was in there, so I just included the webservice folder from the sdk and all worked fine.

libgmail login() runs with error

I just installed libgmail on CentOS 5, python 2.6 with easy_install. There was a problem, until i installed mechanize manually. After that easy_install said OK and i wrote 1st test program from the sample i googled:
import libgmail
ga = libgmail.GmailAccount("someaccount#gmail.com", "mypassword")
ga.login()
folder = ga.getMessagesByFolder('inbox')
for thread in folder:
print thread.id, len(thread), thread.subject
for msg in thread:
print " ", msg.id, msg.number, msg.subject
print msg.source
I get the following error message:
Traceback (most recent call last):
File "gm.py", line 4, in <module>
ga.login()
File "build/bdist.linux-i686/egg/libgmail.py", line 305, in login
File "build/bdist.linux-i686/egg/libgmail.py", line 340, in _retrievePage
File "build/bdist.linux-i686/egg/mechanize/_request.py", line 31, in __init__
File "build/bdist.linux-i686/egg/mechanize/_rfc3986.py", line 62, in is_clean_uri
TypeError: expected string or buffer
It seems, i get a problem not with my python code, but with libgmail installation. Any clues, anyone?
libgmail is deprecated and has stopped developing, since gmail started offering imap access.
Use imaplib or similar (twisted.mail comes to mind, example code here).

Categories

Resources