Can you import python libaries into microPython? [closed] - python

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I have started a project and to test if it works, I used a Pi zero. It has buttons and then sends MIDI Messages to my PC, depending on what buttons are pressed. So a simple MIDI Controller.
Now I think that a Microcontroller, like the Pico would be better suitable for such a task, but it can only run MicroPython.
So my question is, wether you can import most or all of the python libaries into microPython or if I should use another MicroController that can run python.

Usually "no." It won't fit.

So my question is, wether you can import most or all of the python libaries into microPython or if I should use another MicroController that can run python.
While MicroPython shares much of the syntax of Python (3.4), it is different enough that anything but the most trivial Python code will not run under MicroPython. In general, you should only expect to run code developed explicitly for MicroPython on a MicroPython capable device.
So my question is, wether you can import most or all of the python
libaries into microPython or if I should use another MicroController
that can run python.
I don't believe there are any microcontrollers available that can run standard Python. The smallest device you're going to find is probably something like the Raspberry Pi Zero.

Related

Python script to monitor program and control microcontroller [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
NOTE: System will not be connected to a network
I'm automating a device and need to create a script that will communicate with the micro-controller (to drive the motors) and with the original software (Thermo Fisher Scientific). The original software has a GUI interface but no API.
My original thought was to write a python script to first set the motors to the correct position -> then run the software -> save the data -> repeat.
I know how to communicate with the micro-controller to set the motors, but I'm unsure of how to communicate with the original software. Any advice on how to do this with python would be much appreciated.
Alternative methods are also welcome.
Thanks.
I have used AutoIt to solve similar problems. There is a Python extension available (I have never used this).
AutoIt v3 is designed for automating the Windows GUI and general scripting. It uses a combination of simulated keystrokes, mouse movement and window/control manipulation in order to automate tasks.
When using the python extension you will be able to directly interact with the GUI app from your source code.
Alternatively you can also just build an Autoit executable to drive the software if the input into the GUI software is always the same.

How to build a python server to communicate with a raspberry pi? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm an newbie to build a secure connection between python server and raspberry pi.
I have a python server, and a raspberry pi at home.
Currently, pi is using socket to listen a specific port when the python server is trying connect to pi.
It's a low level networking interface. It's a simple but not secure method.
Could anyone tell or point out a way to build a secure communication between python server and raspberry pi. It should be able to do following basic requirements.
1. Password check
2. When python server want some information from Pi, it connect to pi. After python server gets what it wanted, it disconnect to pi.
Thanks!!
It is not easy to provide you an out-of-the-box solution since we don't have any code to refer to but there are several ways to add security to a communication mechanism. Currently the two solutions I'm thinking are :
Using a TLS/SSL wrappers for socket objects and end to end encryption.
Since Python is running both on your server and the Raspberry it's very simple to implement each methods.
EDIT 1 : here is an example for SSL/TLS socket
EDIT 2 : since you are talking about sensors data acquisition in the comments of your question I strongly suggest using a iot oriented communication protocol like MQTT which also provides TLS/SSL security. For the data encryption you can refer to this article.

how can I restart the computer from python script and make the script automatically continue from where it stopped? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I would like to write a python script executing some command.
After some commands I want to reboot the computer (through the script) ,so that the script will continue automatically from where it stopped.
if there's a way to do so thruogh the command line, it will also be helpful, because I can run subprocess.
Thanks!!
It isn't possible to do this "automatically", you need to record some notion of the program's state when the computer shuts down. Conceptually this is no different than having the program exit, then running it again and picking up where it left off (without rebooting).
There are a number of different ways to save state, broadly called serialization. In Python, two common options for serialization are the JSON text format and "pickling", which lets you serialize a Python data structure.
How exactly you serialize your program's state depends on your requirements, but once you've done that you can restart your program (or the whole computer), read in the saved data, and use that to continue progressing from that point.
Shutting down (and running a program at startup) are OS-dependent operations, so you need to provide more context about what environment you're working in to answer more clearly. In Unix you can generally call reboot or sudo reboot to restart your computer.

Run python program on windows 2008 server with web gui [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have made this python (2.7) program that takes a few hours to complete, looping through stuff all the time. I also have a windows 2008 server which I want to use to run this program, I can run it just fine on its own and leave it alone for a while, but I want to use a web interface to achieve the same effect.
I currently use cherrypy and made a form that submits to another page and executes the code there, which works somewhat, but when I close the browser the execution stops. What I really want to do is create a form that provides a function with some arguments and start a standalone python script from there, and possibly also include a stop button to stop the execution. Is this in any way possible?
Yes, this is possible. However, you need to decouple execution of your programme from your web interface.
Probably the simplest setup is to use supervisor to run both your program and your web interface. How your program and your web interface interact is up to you. You could even have your web interface control supervisor, or see if there is a third party web interface for supervisor.
I'm sure it's completely possible, there are numerous modules for Python that act task queue/job queue managers. The first that comes to my mind is Celery.

Library to do a bluetooth dialer [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I need to develop a windows (and preferably also linux) program to dial a number in a bluetooth connected phone. I've doing some research, and only have found these two programs:
Bluetooth PC dialer: windows only program to input phone numbers an dial them with a click
HFP for Linux: linux only software (library+program) to use the pc as a hands free device
First approach was to think about AT commands, but I haven't succeed with that. ¿Does anybody know (or have experience) about which library to use to do only remote dial over bluetooth?
Update 9/5/2013: found some more info, but not able to work with it.
Finally I take the approach of using the operative system tools to stablish a serial connection to the device, and then use chrome app+extension (based on this answer) to send AT commands from javascript app, avoiding to code multi-platform app.

Categories