Google app engine: parse a sql database - sql

I have a MyFile entity with sql db file:
class MyFile(ndb.Model):
data = ndb.BlobProperty()
data property store sql db file. So in requestHandler I need to parse this file.
I am trying to using standard sqlite3 library, but getting error on gae side:
ImportError: No module named _sqlite3
With PyDbLite library I am getting error too:
from PyDbLite.SQLite import Database, Table
File "libs/PyDbLite/SQLite.py", line 81, in <module>
from pysqlite2 import dbapi2 as sqlite
Is there any way to parse sql database in goggle app engine?
I know that gae uses NoSQL datastore, I just need to handle sql db file.

The module _sqlite3 may be in your python path locally, but when deployed, the module cannot be found. You can debug your python path by printing it when in production and making sure the module is visible on that path (keep in mind that any old file or folder isn't considered a module ready for import by python, it needs to have __init__.py).
The only reason you would receive that error is if you either
A) failed to upload the module you're using as part of your project, mistakenly believing that since it was visible to your local python code it should be visible when deployed
or
B) failed to reference the uploaded module correctly. My comments in the first paragraph should help you debug this case.

Related

Neo4j Desktop | Neo.ClientError.Statement.ExternalResourceFailed

Here, I simply introduce my situation about configuration:
System: Windows 11
Neo4j Desktop Version: 1.4.15
when I had finished that imports csv file to the C:\Users\ouyangkang\.Neo4jDesktop\relate-data\dbmss\dbms-00982ce7-0cb6-4ee7-b15a-1bc12ac5890e\import direcotry. I clicked open button and run following command:
LOAD CSV WITH HEADERS FROM 'file:///film_name.csv' AS row MERGE (n:name {name: row.name, encoding: row.encoding});
I got a error:
Couldn't load the external resource at: file:/C:/Users/ouyangkang/.Neo4jDesktop/relate-data/dbmss/dbms-00982ce7-0cb6-4ee7-b15a-1bc12ac5890e/import/film_name.csv
And I saw a similar error solution in Neo.ClientError.Statement.ExternalResourceFailed. I got a new error when configuration the neo4j.conf file
Couldn't load the external resource at: file:/film_name.csv
What's worse, I can't use the import function, it reminded that Trying to open undefined directory.
Please help me, thanks
I finially found the error that it is the file format question. The Neo4j not can use all csv file. You need to convert the file to guaratee the file format is standardized csv file with seperating by ','

Vue.js error when importing amChart data from web API

I'm learning Vue.js with amCharts and trying to build a covid-19 dashboard into a test project using data from amChart's own web API.
Hopefully, I don't need to put all my code on here because I'm just using amChart's demo code and I have the chart working from a module import within my own project, e.g.:
import covid_us_timeline from "#/assets/data/us_timeline";
That's module code I have copied from amChart's web API # covid.amcharts.com/data/js/us_timeline.js
So, that works great, but I want to use the chart directly from the web API, so I'm using this in my Vue.js script section:
import covid_us_timeline from "https://covid.amCharts.com/data/js/us_timeline.js";
And getting this error:
These dependencies were not found:
https://covid.amCharts.com/data/js/us_timeline.js in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/vuetify-loader/lib/loader.js??ref--18-0!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Covid19Chart.vue?vue&type=script&lang=js&
To install them, you can run: npm install --save https://covid.amCharts.com/data/js/us_timeline.js
Error from chokidar (C:): Error: EBUSY: resource busy or locked, lstat 'C:\hiberfil.sys'
It doesn't look like a cors issue and given this is all public domain data, I'd rather use in the front-end than build it in the back-end, so any ideas what I'm doing wrong?
Just as an update, I decided to go a different way anyway as accessing this volume of data from the front-end was a drain to say the least. So, switched to using axios in Node to access the data and load into Mongo and then manipulate it from there. It was only updated once a day anyway, so no need to access it every time the page was loaded.

Error during renaming a package in B1if Integration Framework BPE139 Failure to obtain a lock

I'm trying to rename a disable package in business one integration framework, and i get this error :
Any idea how this could be fix !?
There can be an error in the file so try to rename the package in the xml file. Export the package and then find the xml line where the name is defined. Change it and import the changed package. I had trouble with some funktions in some browers so maybe try an other one.

Jython does not resolve python imports from bundled Lib files/folders on Weblogic 10.3.5

I am new to Jython and Python, trying to build a prototype that makes use of Python code to be called from within Java. The code I am developing works in Jetty and in standalone mode (running java -jar from the command line), but not when deployed to weblogic.
How can I make weblogic(10.3.5) server/Jython recognize the Lib folder within jython-standalone-2.5.4-rc1.jar?
My Java code uses the JythonObjectFactory to invoke python modules as outlined in the Jython book:
http://www.jython.org/jythonbook/en/1.0/JythonAndJavaIntegration.html
The Python modules are using external libraries like csv, logging etc. that are not packaged with jython.jar, hence I am using jython-standalone jar.
The java code includes an interface that would define the class type of the first invoked py module from within java. The interface and the input and output (to python modules) type classes are in a package structure as com.abc.xpackage. and the py modules exist at the root of this package. A controller layer calls the objectfactory and in turn executes the python code thus:
JythonObjectFactory calFactory = new JythonObjectFactory(CalcType.class, "Calculate", "Calculate");
CalcType engine = (CalcType)calFactory.createObject();
output = engine.execute(input);
The entire code is bundled as a jar file which would become part of a web application deployed on weblogic. The code was compiled with maven (with jython dependencies included in the repository) and runs fine on the included Jetty runtime within eclipse.
When deployed on weblogic, however, I get a "ImportError: no module named csv" error.
To analyze what is happening, I tried printing the Jython system state path on weblogic and the standalone environment/Jetty. What I found is,
on Jetty, the system path consists of the following:
C:\.m2\repo\org\python\jython\jython-standalone-2.5.3-rc1.jar\Lib, ____classpath__, ____pyclasspath__
on Weblogic, printing the system path by default shows the following:
____classpath__, ____pyclasspath__
I tried forcing the inclusion of the missing path using the code as follows:
public JythonObjectFactory(PySystemState state, Class interfaceType, String moduleName, String className) {
String pathToAppend = new File(state.getClass().getProtectionDomain().getCodeSource().getLocation().toURI().getPath()).getAbsolutePath()+"\\Lib";
state.path.insert(0, new PyString(pathToAppend));
state.path.append(new PyString(pathToAppend));
System.out.println("Jython sys path: "+state.path);
Please note, I prepended as well as appended the path in different trials. The sys path on weblogic now displays the following:
Jython sys path: ['C:\\wldomain\\wls135\\servers\\cgServer\\tmp\\app-1\\war\\WEB-INF\\lib\\jython-standalone-2.5.4-rc1.jar\\Lib', '__classpath__', '__pyclasspath__/', 'C:\\wldomain\\wls135\\servers\\cgServer\\tmp\\app-1\\war\\WEB-INF\\lib\\jython-standalone-2.5.4-rc1.jar\\Lib']
I am still getting ImportError despite this forcing of sys path. Please help why this works in a local environment, and not on weblogic, and if there is any configuration I am missing. Apologize for the rambling long post, I did not know how to explain the problem better. I will try and include any code/artifacts as needed.
Based on a comment(by Lassi) on the blog post below:
http://www.petervannes.nl/files/e1c3c56d15d25dcfd4adb5397a9ef71e-53.php
The jython issue was resolved after explicitly adding the Lib folder python.path to the weblogic startup script as a JAVA_OPTION.
In my case I added the exploded Lib folder to the domain server lib, but based on my test this works also from within the jython jar. Both the following JAVA_OPTIONS worked:
-Dpython.path=C:\wldomain\wls135\lib\Lib
-Dpython.path=C:\wldomain\wls135\lib\jython-standalone-2.5.4-rc1.jar\Lib
The programmatic way of sys.path.append worked for the local environment(jetty) but did not seem to work for weblogic.

warning in xml.tree in openpyxl

I am using openpyxl from different Python version using following way.
sys.path.insert(0,
'/remote/Python-2.7.2-shared/linux32/lib/python2.7/site-packages/openpyxl-1.6.1-py2.7.egg')
sys.path.insert(1,
'/remote/Python-2.7.2-shared/linux32/lib/python2.7/site-packages')
I will not receive any warning when I directly use particular version.
Python-2.7.2-shared/linux32/lib/python2.7/site-packages/openpyxl-1.6.1-py2.7.egg/openpyxl/shared/compat/elementtree.py:30:
UserWarning: Unable to import 'xml.etree.cElementree'. Falling back on
'xml.etree.Elementree'
I am reading more than 100 xlsx File and did manual testing previously and need to provide quick fix.
As per my understanding, I am reading xlsx File and does not contain any xml element.
So it should not impact any reading data in xlsx File. can be confirm it or can I ignore this warning.
One small thing not related to openpyxl.
is it possible to hide this warning. I do not have root permission
You can ignore warnings. What you are doing is not recommended. The warning is just that without cElementTree your code may run slow. Python does support install packages for in user home directories but using virtual environments (virtualenv) is preferable.