Kivy buildozer: toolchain.py: error: the following arguments are required: --package - python

Everytime I deploy my app, I delete all the stuff in the folder and I load my Github app project (with the .spec) before running buildozer -v android release.
Now I encounter this error: toolchain.py: error: the following arguments are required: --package
but I only changed my python code. How is it possible that changing python stuff makes my .apk creation crash ? What could I try to debug this ?

Found it, you can begin a line with # to make a commentary but you can't do put it following a useful line.

Related

CodeOSS not running python files

For a few weeks now, my Code-OSS has not been running my python scripts. I am running a Garuda linux distribution and have my Code- OSS on version 1.74.2-1 and my python on version 3.10.9-1. Whenever I try to run previously working .py files or make new ones, an error pops up: "Extension activation failed, run the 'Developer: Toggle Developer Tools' command for more information." as well as showing the python extension loading indefinetly. After toggling the developer tools and trying to create a new python file, the following error is shown:
mainThreadExtensionService.ts:111 Activating extension 'ms-python.python' failed: Extension 'ms-python.python' CANNOT use API proposal: telemetryLogger.
Its package.json#enabledApiProposals-property declares: but NOT telemetryLogger.
The missing proposal MUST be added and you must start in extension development mode or use the following command line switch: --enable-proposed-api ms-python.python.
$onExtensionActivationError # mainThreadExtensionService.ts:111
listWidget.ts:803 List with id 'list_id_2' was styled with a non-opaque background color. This will break sub-pixel antialiasing.
style # listWidget.ts:803
log.ts:316 ERR command 'python.createNewFile' not found: Error: command 'python.createNewFile' not found
at b.k (vscode-file://vscode-app/usr/lib/code/out/vs/workbench/workbench.desktop.main.js:1669:3069)
at b.executeCommand (vscode-file://vscode-app/usr/lib/code/out/vs/workbench/workbench.desktop.main.js:1669:2985)
at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
at async vscode-file://vscode-app/usr/lib/code/out/vs/workbench/workbench.desktop.main.js:1740:4663
log.ts:316 ERR command 'python.createNewFile' not found: Error: command 'python.createNewFile' not found
at b.k (vscode-file://vscode-app/usr/lib/code/out/vs/workbench/workbench.desktop.main.js:1669:3069)
at b.executeCommand (vscode-file://vscode-app/usr/lib/code/out/vs/workbench/workbench.desktop.main.js:1669:2985)
at async vscode-file://vscode-app/usr/lib/code/out/vs/workbench/workbench.desktop.main.js:1740:4663
log.ts:316 ERR command 'python.createNewFile' not found: Error: command 'python.createNewFile' not found
at b.k (vscode-file://vscode-app/usr/lib/code/out/vs/workbench/workbench.desktop.main.js:1669:3069)
at b.executeCommand (vscode-file://vscode-app/usr/lib/code/out/vs/workbench/workbench.desktop.main.js:1669:2985)
at async vscode-file://vscode-app/usr/lib/code/out/vs/workbench/workbench.desktop.main.js:1740:4663
I have been struggling with this for a bit now and wanted to ask if anyone knows what to do? Thank you very much in advance and please excuse potentially bad formatting, as I do not know how to do that correctly yet.
I tried reinstalling the Code-OSS package several times, as well as reinstalling python and the extension, however none of it worked.
try running code-OSS like this:
/usr/bin/code-oss --enable-proposed-api ms-python.python
if you're using a desktop enviroment just edit the launcher. Hope this helps

Google app engine deployment fails- Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')

We are using command prompt c:\gcloud app deploy app.yaml, but get the following error:
Running "python3 -m pip install --requirement requirements.txt --upgrade --upgrade-strategy only-if-needed --no-warn-script-location --no-warn-conflicts --force-reinstall --no-compile (PIP_CACHE_DIR=/layers/google.python.pip/pipcache PIP_DISABLE_PIP_VERSION_CHECK=1)"
Step #2 - "build": /layers/google.python.pip/pip/bin/python3: Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')
Step #2 - "build": Done "python3 -m pip install --requirement requirements.txt --upgr..." (34.49892ms)
Step #2 - "build": Failure: (ID: 0ea8a540) /layers/google.python.pip/pip/bin/python3: Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')
Step #2 - "build": --------------------------------------------------------------------------------
Step #2 - "build": Running "mv -f /builder/outputs/output-5577006791947779410 /builder/outputs/output"
Step #2 - "build": Done "mv -f /builder/outputs/output-5577006791947779410 /builder/o..." (12.758866ms)
Step #2 - "build": ERROR: failed to build: exit status 1
Finished Step #2 - "build"
ERROR
ERROR: build step 2 "us.gcr.io/gae-runtimes/buildpacks/python37/builder:python37_20211201_3_7_12_RC00" failed: step exited with non-zero status: 145
Our Requirements.txt is as below. We are currently on Python 3.7 standard app engine
firebase_admin==3.0.0
sendgrid==6.9.3
google-auth==1.35.0
google-auth-httplib2==0.1.0
jinja2==3.0.3
MarkupSafe==2.0.1
pytz==2021.3
Flask==2.0.2
twilio==6.46.0
httplib2==0.20.2
requests==2.24.0
requests_toolbelt==0.9.1
google-cloud-tasks==2.7.1
google-cloud-logging==1.15.1
googleapis-common-protos==1.54.0
Please help.The above code was working well before updating the requirements.txt file. We tried to remove gunicorn to allow the system pickup the latest according to documentation here.
We have a subdirectory structure that stores all the .py files in controllers and db definitions in models. Our main.py has the following -
sys.path.append(os.path.join(os.path.dirname(__file__), '../controllers'))
sys.path.append(os.path.join(os.path.dirname(__file__), '../models'))
Does anyone know how to debug this error - Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__'). What does this mean?
The release 60.3.0 of setuptools has a bug causing the above AttributeError, see : https://github.com/pypa/setuptools/issues/3002
It has been yanked by Pypi since then:
Yanked files are always ignored, unless they are the only file that matches a version specifier that "pins" to an exact version using either == (without any modifiers that make it a range, such as .*) or ===. Matching this version specifier should otherwise be done as per PEP 440 for things like local versions, zero padding, etc.
Source: https://www.python.org/dev/peps/pep-0592/
What you can do as of now is pass the version of the setuptools package explicitly, to use for example version 60.2.0 or 60.3.1.
I had the same issue when deploying a Google Cloud Function. The error
cloud function Error while finding module specification for 'pip' (AttributeError: module 'main' has no attribute 'file'); Error ID: c84b3231
appeared after commenting out some packages in the requirements.txt, but that was nothing important and likely did not cause it. I guess that it is more a problem of an instability in Google Storage, since that same Cloud Function I was working on had lost its archive already some time before, all of a sudden, out of nowhere, showing:
Archive not found in the storage location cloud function
and I did not delete or change anything that might explain this, as Archive not found in the storage location: Google Function would suggest. Though that answer has one very interesting guess that might explain at least the very first time the "Archive not found" error came up and thus made the CF instable: I might have changed the timezone city of the bucket during browsing the Google Storage. It is too long ago, but I know I browsed the GS, therefore, I cannot exclude this. Quote: "It [the Archive not found error] may occurr too if GCS bucket's region is not matched to your Cloud function region."
After this "Archive not found" crash, I manually added main.py and requirements.txt and filled them again with code from the backup. This worked for some time, but there seems to be some general instability in the Google Storage. Therefore, always keep backups of your deployed scripts.
Then, after getting this pip error of the question in that already instable Cloud Function, waiting for a day or two, Google Function again showed
Archive not found in the storage location cloud function
If you run into this pip error in a Cloud Function, you might consider updating pip in the "requirements.txt" but if you are in such an unstable Cloud Function the better workaround seems to be to create a new Cloud Function and copy everything in there.
The pip error probably just shows that the source script, in this case the requirements.txt, cannot be run since the source code is not fully embedded anymore or has lost some embedding in the Google Storage.
Or you give that Cloud Function a second chance and edit, go to Source tab, click on Dropdown Source code to choose Inline Editor and add main.py and requirements.txt manually (Runtime: Python).
By installing the previous version 60.2.0 of setuptools before installing pip-tools helped me get it running.
pip install setuptools==60.2.0
Your setuptools version is likely to be yanked:
https://pypi.org/project/setuptools/60.3.0/
Not sure how to fix that without a working pip though.
Setuptools 60.3.1 is out now. GitHub Link here.

Buildozer gives error 'WindowInfoX11' is not a type identifier

I am using python 2.7.12, buildozer 0.34, cython 0.25.2 and kivy 1.10.0. I am planning to display ads on my app using KivMob. I already have my test device ID and APP_ID. And I tried this code from KivMob.
from kivmob import KivMob
from kivy.app import App
from kivy.uix.button import Button
class KivMobTest(App):
def build(self):
ads = KivMob("ca-app-pub-APP_ID")
ads.add_test_device("TEST_DEVICE_ID")
ads.new_interstitial("ca-app-pub-INTERSTITIAL_ID")
ads.request_interstitial()
return Button(text='Show Interstitial',
on_release= lambda a:ads.show_interstitial())
And wrote this in the buildozer.spec:
requirements = kivy, hostpython2, android, kivmob
android.permissions = INTERNET, ACCESS_NETWORK_STATE
p4a.source_dir = /python-for-android-admob/
p4a.bootstrap = sdl2-admob
But when I ran the command "buildozer -v android debug", it gives an error:
kivy/core/window/window_x11.pyx:221:13: 'WindowInfoX11' is not a type identifier
STDERR:
# Command failed: /usr/bin/python -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2-admob --requirements=kivy,hostpython2,android,kivmob --arch armeabi-v7a --copy-libs --color=always --storage-dir=/home/ken/testads/.buildozer/android/platform/build
#
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2
I tried to build a simple hello world button app which uses same version of python, buildozer, cython and kivy from the above. And used the python-for-android-master.
p4a.source_dir = /python-for-android-master/
and the simple hello world button app was successfully created.
I really wanted to display ads on my app. I would appreciate any kind of help. Thanks.
I faced the same issue and solved by quick setting change.
I use Buildozer 0.35dev, Cython 0.21.2, Python 2.7.12 and Kivy 1.9.0
This issue is related to Kivy version under python-for-android (not Kivy installed in PC).
x11 - ImportError: No module named 'kivy.core.window.window_x11
Master branch is the default Kivy under KivMob python-for-android, so changing this to another version (version 1.10.0 in my case) solves the issue.
Following the steps below:
Go to Kivy recipe folder of KivMob $HOME/python-for-android-admob/pythonforandroid/recipes/kivy,
open __init_.py
edit line 9 (version = 'master') as follows:version ='1.10.0'

pylint complains about empty __init__.py

I get this weird error:
$ epylint .
*************
mysubdir/__init__.py:1: fatal (F0010, parse-error, ) error while code parsing: Unable to load file 'mysubdir/__init__.py' ([Errno 2] No such file or directory: 'mysubdir/__init__.py')
Note that mysubdir/__init__.py does exist and contains a single empty line.
Note that
$ epylint mysubdir
works just fine and produces no messages.
What am I doing wrong?
The problem is you're running pylint in your workdir (pylint .). Pylint will expect an init.py file there.
Take a look at this discussion.
Your best shot is to select the directories you want to lint. If you can't do so (ie: Django project). You'll have to make a custom workaround like in the thread.

pylint with jenkins - complince that can't find xml file

I am trying to run pylint with jenkins with following command:
pylint -f parseable -d I0011,R0801 "mypath\highLevel" | tee.exe pylint.out
The process looks run fine, pylint.out created with a lot of information inside but during pylint report creation I get following error:
13:38:27 ERROR: Publisher hudson.plugins.violations.ViolationsPublisher aborted due to exception
13:38:27 java.io.FileNotFoundException: C:\Users\DMD\.jenkins\jobs\Diamond - Run Coverage\builds\2015-07-26_13-34-30\violations\file\A:\highLevel\Monitor\InitialBootAdapter.py.xml (The filename, directory name, or volume label syntax is incorrect)
It's creates very strange path:
C:\Users\DMD\.jenkins\jobs\Diamond - Run Coverage\builds\2015-07-26_13-34-30\violations\file\A:\highLevel\Monitor\InitialBootAdapter.py.xml
I don't really understand what happens.
Why pylint is interested in file InitialBootAdapter.py? Why it's looks for file InitialBootAdapter.py.xml? Who should create it and why? I searched for this file over all the environment and didn't find. But I did'nt find any xml for my other py files?
Maybe you have experience with pylint and can help?
Thank you.
I have experience with pylint in jenkins. And here is how I use it, hope it will help someone.
Step 1
Add a "Execute Shell" step and execute the pylint command to generate the pylint.out. Please note
/usr/local/bin/pylint -f parseable -d I0011,R0801 my-python-project-folder | tee pylint.out
Step 2
Make sure you have the Violation Report Plugin, after that , click Add post-build action-->Report Violation, put the pylint.out in the corresponding field.
And after the successful run, the pylint report looks like this:
I fixed the problem, it took time and DevOps help but it worked and is described in my own blog (it's more my online notebook than blog) in very small details.
The most important point in this post is small utility
import fileinput, sys
if __name__ == "__main__":
for line in fileinput.FileInput(sys.argv[1], inplace=True):
if ".cs" in line:
line = line.replace("\\", "/")
print line,
Here sys.argv[1] should be path to your violations.xml file.
You have to move the path as a command line argument to the utility as path to your violations.xml file is dynamic and depends on build id.

Categories

Resources