how to share codes between two devices? - python

I want to find a way that I can write some python code on my windows computer, and write continuously of these codes after I go back home on my mac computer. I am trying to set up a jupyter server on my windows, but I failed. Is there any other way that I can do this?

Use Codespaces, basically it creates a codespace and keeps your code in a GitHub repository, you can access, and run the code through a web version of VS code, or you can clone it, revise it, and then push it.

Related

Trying to Debug Python Django application with VS Code remote-containers not running

I've been using the remote-containers in VS Code to run a Python Django application successfully for a couple of months, as I have an M1 machine and it's just a nightmare trying to install all the dependencies locally, and it was working really well.
I came back to the application yesterday and now it's suddenly not working, the container seems to build without any issues and I can see it's running, and the build logs don't present any errors.
But when I try and run with or without debugging the it pops up the run tool bar (start, stop, step ect) for a second and then stops with no output or errors at all. Has anyone seen this before? or have any ideas how to try and get it running again?
Using the rebuild container and rebuild container without cache commands both seem to run without errors
I updated both VS Code and Docker to the latest version
I tried cloning the repository again
I verified that the docker image builds locally without issue
The vs code remote containers plugin seems to still be working because I tried it with a Flask application example I used before to demo the remote-containers to some colleagues and that works without issue.
EDIT
For anyone that comes across a similar thing. I think what happened was the version of python the application was using had support dropped/stopped working for the VS code extension responsible for remote containers, and that's why I could not get it running anymore. Updating the Python version (and going through the pain of also updating the dependencies that now didn't work with the newer version) got this working again.

How to host a script?

I am trying to finish a personal project, which I describe its operation below.
My project consists of running a script (like a service) in the cloud.
I have on the one hand, a python script (created by me) which I want to host, and on the other hand a c++ script (not created by me), which I need to use from my python script, using boost-python.
My first way was to host my python script in pythonanywhere, but it doesn't work for me because the c++ script was designed for windows (it uses libraries only for the windows platform such as windows.h) and when compiling it ends in an error (pythonanywhere uses linux as base system).
So I would like someone to help me and tell me what is the correct way to do what I describe. I understand that it can be one of the following variants, but in some cases I am not entirely convinced that it can, or I do not know how to proceed.
Pay for a Virtual Desktop, and schedule the execution of my python script.
Use what is explained here.
Use a docket image with windows and host it somewhere.
Use Heroku
Note. My project needs/use a database.
Linux also supports C compilation. It's kernel is coded in C. Try compiling your code on linux with a tool like gcc, available on it.

How do I view the results of the compiled python?

I am trying to run the python program from a git repository but I am not understanding where the results are displayed or suppose to be as I want to be able to put the results into a list for a database.
the repository: LINK to Repository
when i run the python program i get this but do not see a .txt file or anywhere that shows the reults
I am fairly new to programming so thanks for any help!
There is hint Running on http://127.0.0.1:5000. The program is a web server. Point your browser to the address. To stop the server type Ctrl+C in the console.

Can't run coursebuilder in google app engine

It is really weird that after clicking run button, it does nothing and also no log and show a clock sign on the first column.
It works normally before. However, after I messed up my python environment, the google coursebuilder can't run web application. That's my guessing. When I run which python.it only shows:
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
These let me feel like I have no way to solve it!Are there anyone who came across this problem before? Any ideas or suggestions?
Updated: I follow suggestions to use command line to run web application on GAE. It reminds me here:
Update: The error message shows that GAE can't get the allocated port and domain. The reason why it happens is that when I use command line to run the web application, I also open GAE GUI to run a web app with the same port number.
So the way to solve it is to close the GAE GUI and free the port. Or we also could designate another kind of port number with command line.(--port=XXXX and --admin_port=YYYY). Or take a look at the doc:
Again thanks for the help of Mihail R!
The OP had multiple issues with GAE setup which were resolved by simply reinstalling the GAE Launcher and making sure the app was first copied into Applications from the .dmg file, then ran from the Applications instead of from inside the .dmg file, and appropriate permissions were suppose to be given so that GAE Launcher created the symlinks it needed to work properly.
More instructions on proper GAE SDK installation can be found here: https://cloud.google.com/appengine/downloads after clicking on the needed SDK and then the OS the SDK will be installed on.

What do I need to successfully run a website in my browser that executes Python scripts?

I currently simply have a local website on my Mac. I can view the webpage's HTMl and CSS and run the javascript functions in browser on my computer, but the next step I want to take is incorporating python scripts for accessing a MySQL database and returning results.
I am clearly new to this, and would love some guidance. Right now, on my computer, I have MySQL installed and I can run it in the terminal just fine. What else do I need as far as database and server equipment – if anything – to get some dynamic website running locally? My current, albeit incredibly limited, understanding is that I have a MySQL database stored on my machine that can be accessed through a Python script – also on my machine – and a link to this script in the HTML file. Is this even right, or do you recommend certain tutorials to fill in the gaps or teach me from the ground up?
I am sorry I am asking a lot; the few tutorials I have found have seemed to cover what I am hoping to do. Many thanks in advance.
Here you go. https://docs.djangoproject.com/en/1.4/intro/install/
Just follow the installation guide, and you'll be up and running in no time.
If you have MySQL installed on your machine along with Python, get a version of MySQLDb library for Python and have fun with it. Moreover, you can do almost any data operation with these combinations. If you want your website to go live (and do not wish to go through web frameworks) just look for a hosting plan that gives you a Python installed server access.

Categories