web2py is not starting with python 3.0/3.1 - python-2.7

I am trying to run a web2py application. Using python2.7 it is running fine.
But I want to use python higher version. When I try with python3.0 or 3.1, am getting an error as
Traceback (most recent call last):
File "/var/www/vhosts/astrozon/web2py/web2py.py", line 18, in <module>
import gluon.widget
File "/var/www/vhosts/astrozon/web2py/gluon/__init__.py", line 15, in <module>
from globals import current
ImportError: No module named globals
I have checked, the module gobals is present in the same folder. and python2.7 is able to import that module but not for 3.0 or 3.1.
I would greatly appreciate any suggestions.

web2py is not compatible with Python 3, and there are no plans to make it so, as that would break its promise to maintain backward compatibility. There have been a couple of experimental attempts at Python 3 forks, but I do not believe they have been maintained. Work has started on a web3py (not the official name) that will be Python 3 compatible, but that is a completely new framework and still in the early stages of development (there is a plan to include a compatibility layer allowing web2py applications to run under it).

Related

django-datatable-view==0.9.0 Django 3.1.3: ImportError: cannot import name 'get_datatable_structure'

I am using the latest package django-datatable-view 0.9.0 in django 3.1.3 (upgrading from django 1.8.6)
When a I run manage.py run server I get the following error:
File "/mcvitty/mcvitty/customers/views.py", line 14, in <module>
from datatableview.utils import get_datatable_structure
ImportError: cannot import name 'get_datatable_structure'
Upgrading the package is not an option as I am already using the latest package. I have searched datatableview get_datatable_structure but I cannot find it. What can I do to fix the error? Thank you for your help
There's a pending PR for that package to fix things for Django 3.1. https://github.com/pivotal-energy-solutions/django-datatable-view/pull/246
You'll need to either
wait until that is merged and a new version released, or
fork the project, merge the fixes you need, bump the version, and use that patched version as a requirement (e.g. https://github.com/YOURGITHUBUSERNAMEHERE/django-datatable-view/archive/master.zip#egg=django-datatable-view)

(Python module serial) No module named utilities.compatibility

I'm trying to build the PiPhone ^1, but when I execute python piphone.py, I receive the following:
I cannot seem to find anyone else who has experienced this problem. What are ways you all suggest I resolve this?
https://github.com/climberhunt/PiPhone
I've used pip uninstall serial but I haven't gotten very far solution-wise.
Traceback (most recent call last):
File "ttest.py", line 2, in <module>
import serial
File "/home/pi/.local/lib/python2.7/site-
packages/serial/__init__.py", line 10, in <module>
from . import utilities, abc, model, marshal, errors,
properties, meta, hooks, test, request
File "/home/pi/.local/lib/python2.7/site-
packages/serial/model.py", line 11, in <module>
from .utilities.compatibility import backport,
BACKWARDS_COMPATIBILITY_IMPORTS
ImportError: No module named utilities.compatibility
You installed the wrong package. You have installed serial, which is a Python package to handle object serialisation and deserialisation from and to YAML, JSON and XML and appears to be broken at the moment (I don't think the author is all that experienced in Python package development yet). Someone else already filed an issue with the package to have it renamed.
You want to install pyserial instead, which is a library to handle serial port connections.

Getting no module named _internals error while using Bloomberg API

I am currently using Python 2.7 and my OS is Windows 7. While attempting to use the Bloomberg API I am getting this error:
Traceback (most recent call last):
File "datagrab.py", line 1, in <module>
import blpapi, time, json
File "C:\Python27\lib\blpapi\__init__.py", line 5, in <module>
from .internals import CorrelationId
File "C:\Python27\lib\blpapi\internals.py", line 50, in <module>
_internals = swig_import_helper()
File "C:\Python27\lib\blpapi\internals.py", line 42, in swig_import_helper
import _internals
ImportError: No module named _internals
I have set my path variable to point to blpapi3_64.dll and also updated my bloomberg terminal. I have also moved the local blpapi API to a different directory but still the problem exists.
I am kind of new to this API in general. So can someone please guide me?
Thank you in advance!
From your question is sounds like maybe you have tried this, but just outlining one possible solution from the README in the Python Supported Release release available here.
Note that many Python installations add the current directory to the
module search path. If the Python interpreter is invoked from the
installer directory, such a configuration will attempt to use the
(incomplete) local blpapi directory as a module. If the above
import line fails with the message Import Error: No module named
_internals, move to a different directory before invoking python.
I know this question is a bit stale, but in case people end up here like me. Do you have the C++ version of blpapi? it is a requirement for the python api as mentioned here: https://www.bloomberg.com/professional/support/api-library/
so download the C++ zip installer, extract somewhere, and then add it as an environment variable so that the python api can find it:
Environment variable name: BLPAPI_ROOT
Value: C:\blp\blpapi_cpp_3.8.18.1 (THIS IS WHERE MINE IS INSTALLED, YOUR VALUE HERE MAY BE DIFFERENT)
Hope that helps!

pip installer seems not to write in the PATH in a Python server

I tried to download Graphlab from Turi wit the following tutorial. I coded with their tools and tried to compute a Python script but it answered me an ImportError.
(gl-env)ubuntu#ip-172-hey-hey-hey:~/Eclipse-Stats$ source deactivate
discarding /home/ubuntu/anaconda2/envs/gl-env/bin from PATH
ubuntu#ip-172-hey-hey-hey:~/Eclipse-Stats$ unset PYTHONPATH
ubuntu#ip-172-hey-hey-hey:~/Eclipse-Stats$ python Main.py
2017-07-27 14:56:00.520425
/home/ubuntu/.local/lib/python2.7/site-packages/sklearn/cross_validation.py:44: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.
"This module will be removed in 0.20.", DeprecationWarning)
Traceback (most recent call last):
File "Main.py", line 3, in <module>
import prediction
File "/home/ubuntu/Eclipse-Stats/prediction.py", line 1, in <module>
from graphlab.toolkits.recommender import ranking_factorization_recommender
ImportError: No module named graphlab.toolkits.recommender
Actually it cames often on the server when I tried to download with pip numpy, scipy, sklearn... Like we can see in the following conversation (in Spanish) between FJSevilla and the man of my team I'm working with.
Two things: (1) check the version of your Python console and see if it matches or is higher than the compatibility with the packages. If you look at the depreciation message and read it through, you would understand what is going on a little more. (2) be careful of what you are importing and how you import them because your formatting might also be a syntactic all error. One thing you could do is find the package, manually download, unzip, then run the setup.py.

Installing Django on Jython

I am trying to install Django with Jython.
System - Windows 7, 64bit
Jython - 2.5.4rc1 (installed succesfully)
Django - 1.5 (not yet installed)
When I am in the unpacked Django-1.5 directory and try to run the command line instruction
'jython setup.py install'
I get the error message:
Traceback (most recent call last):
File "setup.py", line 84, in (module)
version = __import__('django').get_version()
File "E:\jython2.5.4rc1\bin\Django-1.5\django\__init__.py", line 6, in get_version
from django.utils.version import get_version
File "E:\jython2.5.4rc1\bin\Django-1.5\django\utils\version.py", line 1
SyntaxError: future feature unicode_literals is not defined
I can imagine that it is something very simple that only an ABSOLUTE NEWBIE could ever get wrong. So we all know what I am :)
Many thanks for any help in taking my first wobbly steps.
Django 1.5 has dropped support for Python 2.5. Therefore, you have to use a Jython 2.7 alpha release if you want to use Django 1.5 with Jython. Please use Django 1.4 if you want to keep using Django on a stable Jython version.
https://docs.djangoproject.com/en/dev/howto/jython/