-
shiro
I am beginner of pythonista and AR.
I want to make "AR TSUNAMI depth" display.
Xcode is often used,but I have not Macbook.
I use Windows7.so I have to make by pythonista3 and ARKit.
Is there a good sample ?
I am thinking of entering tsunami height and add GIS heights.
After that, displaying TSUNAMI heights.Can I use the following code etc applying 'SceneKit' and 'ARKit'
https://github.com/Brun0oO/Pythonista/blob/master/arkit/main.py
-
shiro
Dear cvp
Creating a web frame using bottle was the first experience. Thank you for your kindness.
-
shiro
Dear cvp
I am sorry. I missed to import file name.
It's not "777.html" but "777.htm".
Finally, I succesed to run html from Safari.
I realy appreciated your devoting kindness!I can do like bellow.
①In Pythonista3 (iCloud/777/777.py), run "777.py"
②In 777.py "console" monitor, tap "http://localhost:5000" → need to get URL
③In Safari,input URL "http://localhost:5000/iCloud/777/777.htm
④Appeare "777.htm" on the monitor and run.
It's really usefull code.
Thank you so much!
I appreciated your work.
-
shiro
Dear cvp
I did iphone and PC conect icloud.
so,I try another way.
Only iphone did.and change localhost from 8080 to 5000 because 8080 alredy used message.
Finally, safari sever reply like bellow.
Bottle v0.12.5 server starting up (using MyWSGIRefServer())...
Listening on http://localhost:5000/
Hit Ctrl-C to quit.127.0.0.1 - - [28/Mar/2019 07:07:07] "GET / HTTP/1.1" 404 720
iCloud/777/777.html 777.html /private/var/mobile/Library/Mobile Documents/iCloud~com~omz-software~Pythonista3/Documents/777In safari,
http://localhost:5000/iCloud/777/777.html
http://127.0.0.1:5000/iCloud/777/777.html
but,"File does not exist"
error continue,but almost I think.
Does wrong procedure in safari http comand?
-
shiro
I don't know how to appended picture of Safari monitar hardcopy (png file).
On the top of monitor of Safari,"localhost" letter apperes.
and middle monitor of Safari,"Can not open page. Safari can not conect sever"Still, I failed.
・iphone
http://localhost:8080/iCloud/777/777.html
・PC jyupyter notebook
#coding: utf-8 import ui import threading import requests import os from bottle import Bottle, ServerAdapter, route, static_file class MyWSGIRefServer(ServerAdapter): server = None def run(self, handler): from wsgiref.simple_server import make_server, WSGIRequestHandler if self.quiet: class QuietHandler(WSGIRequestHandler): def log_request(*args, **kw): pass self.options['handler_class'] = QuietHandler self.server = make_server(self.host, self.port, handler, **self.options) self.server.serve_forever() def stop(self): self.server.shutdown() app = Bottle() @app.get('/<path:path>') def bottle_get(path): from bottle import static_file import os # http://localhost:8080/MesTests/test.jpg # http://localhost:8080/iCloud/MesTests/test.jpg # path = folder/file # path = iCloud/folder/file t = 'iCloud/' if path[:len(t)] == t: full_path = ('/private/var/mobile/Library/Mobile Documents/iCloud~com~omz-software~Pythonista3/Documents/' + path[len(t):]) else: full_path = os.path.expanduser('~/Documents/' + path) i = full_path.rfind('/') filename = full_path[i+1:] root = full_path[:i] #print(path,filename,root) #print(path,filename,root) return static_file(filename, root=root) if __name__ == '__main__': port = 8080 server = MyWSGIRefServer(host='localhost',port=port) t = threading.Thread(group=None, target=app.run, name='BottleWebServer', args=(), kwargs={'server': server, 'quiet': False}) t.server = server # used by threads_indicator_in_status_bar to stop thread t.port = port # used by Add home screen shortcut t.start()
After run jyupyter notebook python,
Bottle v0.12.16 server starting up (using MyWSGIRefServer())...
Listening on http://localhost:8080/
Hit Ctrl-C to quit. -
shiro
Dear cvp
Thank you for advice.
Html file in iCloud Drive/Pythonista3.
iCloudDrive/iCloud~com~omz-software~Pythonista3/777/777.ipynb
I tryed your code like bellow.
#coding: utf-8 import ui import threading import requests import os from bottle import Bottle, ServerAdapter, route, static_file class MyWSGIRefServer(ServerAdapter): server = None def run(self, handler): from wsgiref.simple_server import make_server, WSGIRequestHandler if self.quiet: class QuietHandler(WSGIRequestHandler): def log_request(*args, **kw): pass self.options['handler_class'] = QuietHandler self.server = make_server(self.host, self.port, handler, **self.options) self.server.serve_forever() def stop(self): self.server.shutdown() app = Bottle() @app.get('/<path:path>') def bottle_get(path): from bottle import static_file import os # http://localhost:8080/MesTests/test.jpg # http://localhost:8080/iCloud/MesTests/test.jpg # path = folder/file # path = iCloud/folder/file path = iCloudDrive/777/777 t = 'iCloud/' if path[:len(t)] == t: full_path = ('/private/var/mobile/Library/Mobile Documents/iCloud~com~omz-software~Pythonista3/Documents/' + path[len(t):]) else: full_path = os.path.expanduser('~/Documents/' + path) i = full_path.rfind('/') filename = full_path[i+1:] root = full_path[:i] #print(path,filename,root) return static_file(filename, root=root) if __name__ == '__main__': port = 8080 server = MyWSGIRefServer(host='localhost',port=port) t = threading.Thread(group=None, target=app.run, name='BottleWebServer', args=(), kwargs={'server': server, 'quiet': False}) t.server = server # used by threads_indicator_in_status_bar to stop thread t.port = port # used by Add home screen shortcut t.start()
sever runnung, and I open html file using sagari like this.
http://localhost:8080/iCloudDrive/777.html
but still do not open file.
Safari monitor is wrriten error meesage Japanese .
meaning is,
"Can not open page. Safari can not conect sever"
-
shiro
Dear cvp
In iCloud Drive, I make '777' folder and put into two file '777.htm' , '777.ipynb' .
777---|---777.htm (java) three.min.js , preloadjs.min.js
|
|---777.ipynbThen, Run '777.ipynb'
・777.ipynb
!pip install bottle
import sys, os, subprocess
from bottle import route, run, static_file, ServerAdapterclass SSLWebServer(ServerAdapter):
def run(self, handler):
from gevent.pywsgi import WSGIServer
srv = WSGIServer( (self.host, self.port), handler,
certfile='./server.pem', keyfile='./server.pem')
srv.serve_forever()@route('/<filename:path>')
def static(filename):
return static_file(filename, root="/Users/shiro/source/py35_opencv3/")run(host='0.0.0.0', port=8080, server=SSLWebServer)
After that, localhost sever running.
Next, I have to open '777.htm' file with iPhone using Safari.
But I do not know how to open it using Safari from iCloud Drive '777' folder.
-
shiro
Hello.
I try to open 'html' file use iPhone colaborate with iCloud Drive.
In iCloud Drive, sever run by python code.
But I can not open html file.How can I open 'html' file ?
Could you let me know.I am bigginer iphone and pythonista3.
so I can not open html file by Safari.My environment is,
・pythonista3、stash、icloud Drive
・iOs12、iphoneXR, Safari
-
shiro
Dear JonB
Thank you for kindness.
I remove python code, and import new.
I successed for running.
Thanks a lot.
-
shiro
Hello. I am bigginer of pythonista3.
I would like to run python code bellow,
・py code
import matplotlib.pyplot as plt
but, run error.
module 'matplotlib' has no attribute 'cbook'
How can I do for this problem ?
Could you let me know.My environment is,
・pythonista3、stash、icloud Drive
・iOs12、iphoneXR
-
shiro
Dear cvp
I succeed!
Thank you for your kindness!
I reary appricieded.
thanks a lot!
-
shiro
Dear cvp
Thanks a lot.
I could extract zip file.
Then, in "This iphone" , I get "objc_tools-master" folder.
but I am bigginer iphone, I do not know how
move the "objc_tools" directory to site-packages
I am glad how to do it.
-
shiro
Hellow. I am japanese.
I cought Pythonista3.
I would like to run python code bellow,
・py code
from objc_tools.scenekit.util import SUPPORTED_FORMATS, LightType
but, run error.
ModuleNotFoundError
No module named 'objc_tools'In the README.md、
Put objc_tools in your site-packages folder.
https://github.com/scj643/objc_tools
but I am bigginer iphone and pythonista3.
How can I put objc_tools in my site-packages folder ?
My environment is,
・pythonista3、stash、icloud Drive
・iOs12、iphoneXR