Burn MaixPy on Sipeed M1W - cmake

I am using Sipeed M1W and its LCD display white screen after I burned the demo.
Then I built and compiled MaixPy and burned micropython.bin to the board but it's still white and display following message on the terminal.
Official Site:http://www.sipeed.com/
Wiki:http://maixpy.sipeed.com/
[MAIXPY]Pll0:freq:320666666
[MAIXPY]Pll1:freq:159714285
[MAIXPY]Flash:0xc8:0x17
[MAIXPY]:Spiffs Mount successful
Traceback (most recent call last):
File "boot.py", line 14, in <module>
File "init.py", line 4, in <module>
OSError: [Errno 5] EIO
MicroPython d58620d on 2018-12-11; Sipeed_M1 with kendryte-k210
Type "help()" for more information.
>>>
According to the document it seems something go wrong in camera, but I don't know how to fix it or where I can find .bin to burn to the board make it works.

I got some help in the telegram group for this.
"You can delete code "import app" in boot.py, then compile and burn it agian"
but what worked for me finally was doing the extra step...
make pack_kfpkg
The kfpkg file will be in: C:\abc\MaixPy\ports\k210-standalone and you should flash that.
I put a MicroPython on the M1W board install guide on my blog here: https://robotzero.one/sipeed-maix-micropython/

Related

Problems with GDAL, Libspatialite, Rasterio and Sumo (ImportError, Symbol _GEOSArea not found, Referencing from libspatialite.7.dylib)

I'm new to using gdal/libspatialite/rasterio/sumo and all the family of library and packages that is related to geographical, time and space. But I was just wondering what's this error here? Does anyone have experience with this error before? Have you seen it before? And if so have you been able to resolve it? And if so, what were the things you did to resolve it. I'm stuck with this for almost days now and idk what else to do. I'm running this on Python 3.9.6 on a MacOS Big Sur. I'm confused whether the problem is either one of these packages (or a combination of).
It's really annoying how it doesn't work here but works perfectly fine in my old computer that runs in MacOS Catalina with Python 3.9.0. Thank you in advance for your time.
File "/opt/homebrew/lib/python3.9/site-packages/contextily/__init__.py", line 7, in <module>
from .place import Place, plot_map
File "/opt/homebrew/lib/python3.9/site-packages/contextily/place.py", line 7, in <module>
from .tile import howmany, bounds2raster, bounds2img, _sm2ll, _calculate_zoom
File "/opt/homebrew/lib/python3.9/site-packages/contextily/tile.py", line 16, in <module>
import rasterio as rio
File "/opt/homebrew/lib/python3.9/site-packages/rasterio/__init__.py", line 9, in <module>
from rasterio._base import gdal_version
ImportError: dlopen(/opt/homebrew/lib/python3.9/site-packages/rasterio/_base.cpython-39-darwin.so, 2): Symbol not found: _GEOSArea
Referenced from: /opt/homebrew/opt/libspatialite/lib/libspatialite.7.dylib
Expected in: flat namespace

Error using pymtp and libmtp

I am new to programming on python and i am trying to create an application which uses pyMTP to communicate to an MTP device. However im getting this error and cant figure out the fix for it.
$ python c:/Users/Atul/Desktop/mtp.py
None
Traceback (most recent call last):
File "c:/Users/Atul/Desktop/mtp.py", line 2, in <module>
import pymtp
File "C:\Users\Atul\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pymtp.py", line 42, in <module>
_libmtp = ctypes.CDLL(_module_path)
File "C:\Users\Atul\AppData\Local\Programs\Python\Python36-32\lib\ctypes\__init__.py", line 348, in __init__
self._handle = _dlopen(self._name, mode)
TypeError: LoadLibrary() argument 1 must be str, not None
Think it is not a program, but a library, you have to import. Like once in python, import mtp (or import pymtp, i don't know anymore). Please be aware pymtp is about 5 years old and does only run on python 2. I have been working on a python 3 version but it's not really complete because i found testing MTP software is extremely time consuming because the mtp interface is very, very slow at startup. I suggest to look at gMTP to transfer you files.

Tensorboard __init__() got an unexpected keyword argument 'purge_orphaned_data'

Running tensorboard for first time in a new VM and I end up with this error at tensorboard init(). Thanks for the help.
Traceback (most recent call last):
File "/home/sarath/virtualenvs/tensorflow/bin/tensorboard", line 9, in module> load_entry_point('tensorflow==0.7.1', 'console_scripts', 'tensorboard')()
File "/home/sarath/virtualenvs/tensorflow/local/lib/python2.7/site-packages/tensorflow/tensorboard/tensorboard.py", line 82, in main
purge_orphaned_data=FLAGS.purge_orphaned_data)
TypeError: __ init__() got an unexpected keyword argument 'purge_orphaned_data'
TensorBoard developer here. I'm quite confused how this happened, because while the purge_orphaned_data flag exists in master, it doesn't exist in r0.7.1. Actually, the file path tensorflow/tensorboard/tensorboard.py doesn't exist in 0.7.1 (it is in tensorboard/backend/tensorboard.py in 0.7.1).
So it looks like somehow you got an installation that mixes r0.7.1 but also files from master. Could you please file a Github issue on TensorFlow with a repro on how you got into this state?
I have the same problem. I deleted "purge_orphaned_data=FLAGS.purge_orphaned_data" and it worked.

Issues importing a custom toolbox within another custom tool

I'm trying to call on a custom python script within another script. Everything works fine if I run the script standalone outside of ArcGIS, but if I try to make it a custom tool with parameters, it gives me the following error:
Traceback (most recent call last):
File "C:\Users\jamil.harvich\Documents\ArcGIS\Python_Scripts\Working\IP_Anno\Script\Script_Part1.py", line 80, in <module>
arcpy.ConcatenateRowValues_AA(lyr[0] + '_Intersect', 'SHORT_DESC', 'NAME', lyr[2], '-')
File "C:\Users\jamil.harvich\Documents\ArcGIS\Python_Scripts\Working\IP_Anno\ConcatenateRowValues101.tbx", line 54, in ConcatenateRowValues
/jVXV+BHwwJ5+Gfgv/wnbP8A+NV2Eo+ZTjHPQ9qlR60cIvojBSkupxw+Avwvz/yTTwX/AOE7Z/8A
AttributeError: Object: Tool or environment <ConcatenateRowValues_AA> not found
Failed to execute (Script).
Thanks. I hope the question is clear. If you need me to specify anything, just ask.
Before calling it, in your script you should import the Toolbox that contains your tool "ConcatenateRowValues_AA", with the command:
arcpy.ImportToolbox(TOOLBOX_PATH)
where TOOLBOX_PATH is the absolute path to your .tbx file.

How to rewrite a specific frame in a traceback?

In python you can compile() string to be executed faster with exec(). But as soon as i use it, we lost information when an exception happen in the exec.
For example, here is a code snippet that calling a unknown method (for demo purposes):
code = 'my_unknown_method()'
bytecode = compile(code, '<string>', 'exec')
And later, i'm calling exec on that bytecode:
exec bytecode
The traceback showed is:
Traceback (most recent call last):
File "test.py", line 3, in <module>
exec bytecode
File "<string>", line 1, in <module>
NameError: name 'my_unknown_method' is not defined
The "exec()" frame is now obscure. I would like to have a better exception like:
Traceback (most recent call last):
File "test.py", line 3, in <module>
exec "my_unknown_method()"
File "<string>", line 1, in <module>
NameError: name 'my_unknown_method' is not defined
Any thoughts ?
Notes:
I don't want to use the second argument of compile (the filename)
I have tested to play with inspect and modify f_code on the frame, but it's readonly attribute.
EDIT: after looking more to sys.excepthook, i've seen that in python source code/traceback.c, when python want to show the line content, they are fopen() directly the file if found. No hook available at all to display our own content. The only way would be to create in real fake filename on disk ? Anyone ?
EDIT2: i checked some jinja2 debug code, and they are rewriting traceback too, but not for content. Would i need a custom except hook ? My concerns with it is since it's not in the traceback itself, if an user/module/whatever take the exception, the traceback will not contain valuable information.
You should have a look at this talk by Armin Ronacher. He's the author of Jinja2 and in this talk he explained, how he manipulates stack traces in Jinja2. If I remember correctly, he's using ctypes, to manipulate the data structures on the C level of Python. The talk was in my opinion the best talk of the whole Europython 2011 by the way.
After a deep search, it's not possible, CPython is using its own API to determine where the file is etc, and it cannot be patched in pure Python.
How about something like this:
import sys
def mkexec(code_str):
bc = compile(code, '<string>', 'exec')
def run():
try:
exec bc
except: # Yes I know a bare except
t, v, tb = sys.exc_info()
raise MyUsefullException("%s raised %s" % (code_str, v))
return run
exe = mkexec("some_unknown_something()")
exe()