Problems with let otree devserver run - python

I have a Python Code to conduct an experiment. To ensure that the Code is working smoothly I wanted to run a trial round via 'otree devserver', but I always get an AttributeError message and I am stuck here. Can anyone help me out?
I have downloaded the Code from GitHub and downloaded all required packages. I am using macOS, otree-5.10.2 and django-4.1.7. Here is my full traceback / error message:
Traceback (most recent call last): File
"/Users/.otreevenv/bin/otree", line 8, in
sys.exit(execute_from_command_line()) File "/Users/.otreevenv/lib/python3.10/site-packages/otree/main.py", line
108, in execute_from_command_line
setup() File "/Users/.otreevenv/lib/python3.10/site-packages/otree/main.py", line
132, in setup
from otree import settings File "/Users/.otreevenv/lib/python3.10/site-packages/otree/settings.py",
line 50, in
OTREE_APPS = get_OTREE_APPS(settings.SESSION_CONFIGS) File "/Users/.otreevenv/lib/python3.10/site-packages/django/conf/__init__.py",
line 94, in __getattr__
val = getattr(_wrapped, name) File "/Users/.otreevenv/lib/python3.10/site-packages/django/conf/__init__.py",
line 270, in __getattr__
return getattr(self.default_settings, name) AttributeError: module 'django.conf.global_settings' has no attribute 'SESSION_CONFIGS'. Did
you mean: 'SESSION_ENGINE'?

Related

Tableau Server API Python (Tableau_Tools)

I am trying to do some basic api integration with Tableau server.
I was trying the Tableau_tools library (https://github.com/bryanthowell-tableau/tableau_tools).
I am unable to get simple create AD group or add user working. Is there something I am doing wrong?
I am able to view users/groups.
This is my code:
t = TableauServerRest37(cfg["server"], pat_name=cfg['personal_access_token_name'], pat_secret=cfg['personal_access_token_secret'], site_content_url=cfg["site_url"])
t.signin()
t.enable_logging(logger)
list_of_groups = t.groups.query_groups_json()
list_of_users = t.users.query_users_json()
#Add Users
users_to_add = ['user_1', 'user_2', 'user_3']
for user in users_to_add:
t.users.add_user(username=user, fullname=user, site_role='Publisher')
t.groups.create_group_from_ad_group( group, domain, default_site_role="ExplorerCanPublish", sync_as_background=True)
I am getting the following Error for Users:
Traceback (most recent call last):
File ".\Tableau_tools_api.py", line 117, in <module>
main()
File ".\Tableau_tools_api.py", line 82, in main
t.users.add_user(username=user, fullname=user, site_role='Publisher')
File "C:\Users\ABCD\AppData\Roaming\Python\Python37\site-packages\tableau_tools\tableau_rest_api\methods\user.py", line 164, in add_user
update_if_exists=update_if_exists, auth_setting=auth_setting)
File "C:\Users\ABCD\AppData\Roaming\Python\Python37\site-packages\tableau_tools\tableau_rest_api\methods\user.py", line 89, in add_user_by_username
if site_role not in self.rest.site_roles:
AttributeError: 'TableauServerRest37' object has no attribute 'site_roles'
I am getting the following Error for Groups:
Traceback (most recent call last):
File ".\Tableau_tools_api.py", line 117, in <module>
main()
File ".\Tableau_tools_api.py", line 88, in main
t.groups.create_group_from_ad_group( group, domain, default_site_role="ExplorerCanPublish", sync_as_background=True)
File "C:\Users\ABCD\AppData\Roaming\Python\Python37\site-packages\tableau_tools\tableau_rest_api\methods\group.py", line 74, in create_group_from_ad_group
if default_site_role not in self.rest._site_roles:
AttributeError: 'TableauServerRest37' object has no attribute '_site_roles'
I was wondering if anyone has gotten this to work for api version 3.7?

After starting spyder: ImportError: cannot import name 'quick_guide'

When I start spyder the internal console pops up and gives the following "traceback":
>>> WARNING:traitlets:kernel died: 6.001837253570557
Traceback (most recent call last):
File "C:\...\lib\site-packages\traitlets\traitlets.py", line 528, in get
value = obj._trait_values[self.name]
KeyError: 'banner'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\...\lib\site-packages\qtconsole\base_frontend_mixin.py", line 163, in _dispatch
handler(msg)
File "C:\...\lib\site-packages\qtconsole\jupyter_widget.py", line 296, in _handle_kernel_info_reply
super(JupyterWidget, self)._started_channels()
File "C:\...\lib\site-packages\qtconsole\frontend_widget.py", line 617, in _started_channels
self.reset(clear=True)
File "C:\...\lib\site-packages\qtconsole\frontend_widget.py", line 661, in reset
self._append_plain_text(self.banner)
File "C:\...\lib\site-packages\traitlets\traitlets.py", line 556, in __get__
return self.get(obj, cls)
File "C:\...\lib\site-packages\traitlets\traitlets.py", line 535, in get
value = self._validate(obj, dynamic_default())
File "C:\...\lib\site-packages\spyder\widgets\ipythonconsole\shell.py", line 280, in _banner_default
return self.long_banner()
File "C:\...\lib\site-packages\spyder\widgets\ipythonconsole\shell.py", line 91, in long_banner
from IPython.core.usage import quick_guide
ImportError: cannot import name 'quick_guide'
The IPython console works without problems, it is just missing the "introduction text" (python version, help-commands).
Can I just ignore this exception or is there a way to fix this manually?
(Spyder developer here) This was fixed in Spyder 3.1.4 (just released). Please update to fix it.
To fix the exception manually one needs to change the last mentioned file in the traceback. In this case this one:
File "C:\...\lib\site-packages\spyder\widgets\ipythonconsole\shell.py", line 91, in long_banner
from IPython.core.usage import quick_guide
ImportError: cannot import name 'quick_guide'
and change quick_guide to quick_reference as quick_guide. One may need to restart Spyder but then the Exception disappeared.
I solved:
Only use conda install spyder=3.1.4 in your conda env.
Regards.

vboxapi COM API not working

I have the virtualbox 5.0.10 Python sdk in my source root, but when I run my code the program will fail:
Traceback (most recent call last):
File "C:/Users/xiao/.PyCharm50/config/scratches/scratch", line 2, in <module>
mgr=vboxapi.VirtualBoxManager()
File "C:\Users\xiao\Desktop\test\vboxapi\__init__.py", line 1018, in __init__
self.platform = PlatformMSCOM(dPlatformParams)
File "C:\Users\xiao\Desktop\test\vboxapi\__init__.py", line 513, in __init__
win32com.client.gencache.EnsureDispatch('VirtualBox.Session')
File "C:\Python27\lib\site-packages\win32com\client\gencache.py", line 540, in EnsureDispatch
disp_class = CLSIDToClass.GetClass(str(disp_clsid))
File "C:\Python27\lib\site-packages\win32com\client\CLSIDToClass.py", line 46, in GetClass
return mapCLSIDToClass[clsid]
KeyError: '{7844AA05-B02E-4CDD-A04F-ADE4A762E6B7}'
Here is my code: (really simple, right?)
import vboxapi
mgr=vboxapi.VirtualBoxManager()
This program is buggy under Python 2.7.6, but runabble under Python 3.4.0.
Why? How can I fix that?

AttributeError: 'Response' object has no attribute '_dom'

I'm testing ebaysdk Python library that lets you connect to ebay. Now I'm trying examples from: https://github.com/timotheus/ebaysdk-python/
So far I got stuck at this example:
from ebaysdk.shopping import Connection as Shopping
shopping = Shopping(domain="svcs.sandbox.ebay.com", config_file="ebay.yaml")
response = shopping.execute('FindPopularItems',
{'QueryKeywords': 'Python'})
print response.disct()
When I run it. It gives me this error:
Traceback (most recent call last):
File "ebay-test.py", line 13, in <module>
{'QueryKeywords': 'Python'})
File "/usr/local/lib/python2.7/dist-packages/ebaysdk-2.1.0-py2.7.egg/ebaysdk/connection.py", line 123, in execute
self.error_check()
File "/usr/local/lib/python2.7/dist-packages/ebaysdk-2.1.0-py2.7.egg/ebaysdk/connection.py", line 193, in error_check
estr = self.error()
File "/usr/local/lib/python2.7/dist-packages/ebaysdk-2.1.0-py2.7.egg/ebaysdk/connection.py", line 305, in error
error_array.extend(self._get_resp_body_errors())
File "/usr/local/lib/python2.7/dist-packages/ebaysdk-2.1.0-py2.7.egg/ebaysdk/shopping/__init__.py", line 188, in _get_resp_body_errors
dom = self.response.dom()
File "/usr/local/lib/python2.7/dist-packages/ebaysdk-2.1.0-py2.7.egg/ebaysdk/response.py", line 229, in dom
return self._dom
File "/usr/local/lib/python2.7/dist-packages/ebaysdk-2.1.0-py2.7.egg/ebaysdk/response.py", line 216, in __getattr__
return getattr(self._obj, name)
AttributeError: 'Response' object has no attribute '_dom'
Am I missing something here or it could be some kind of bug in library?
Do you have a config file? I had a lot of problems getting started with this SDK. To get the yaml config file to work, I had to specify the directory that it was in. So in your example, it would be:
shopping = Shopping(domain="svcs.sandbox.ebay.com", config_file=os.path.join(os.path.dirname(os.path.realpath(__file__)), 'ebay.yaml'))
You should also be able to specify debug=true in your Shopping() declaration as in Shopping(debug=True).
Make sure if you have not, to specify your APP_ID and other necessary values in the config file.
You have the wrong domain, it should be open.api.sandbox.ebay.com. See this page on the ebaysdk github.

OSError: Result too large

I'am playing around with scapy but i cant get it to work. I tried different code's but all gave me the same output:
Traceback (most recent call last):
File "<module1>", line 7, in <module>
File "C:\Python26\lib\site-packages\scapy\sendrecv.py", line 357, in srp
s = conf.L2socket(iface=iface, filter=filter, nofilter=nofilter, type=type)
File "C:\Python26\lib\site-packages\scapy\arch\pcapdnet.py", line 313, in __init__
self.outs = dnet.eth(iface)
File "dnet.pyx", line 112, in dnet.eth.__init__
OSError: Result too large
Iam using python 2.6 with all dependencies installed for scapy.
How to fix this?

Categories