Python handy batch

Python handy batch

Here's a little Python-related batch I use all the time as a practice for Qiita posts.

Python filename batch

This batch is used when the command operation is troublesome and you want to execute it by double-clicking when executing the python file being edited, or when you want to start it with the task scheduler. If you save the following batch as "python file name you want to execute.bat", you can execute python by double-clicking.

PythonFile.bat


rem Move to batch storage folder
cd %~p0

Activate the rem conda environment
call activate scraping_env

rem batch file filename.Run py python file
python %~n0%.py

Wait when the rem Python script finishes
pause

Python file example

PythonFile.py


print("You can run the same python file as the batch name.")

Yeah, you don't need it if you associate it with an executable program! !!

Jupyter launch batch

The following is a setting that allows you to access Jupyter from another PC with a password. I have set the following batch in the task scheduler to be executed when the PC is started.

rem Go to work space
mkdir cd C:\Users\xxxxxx\Documents\PythonScript
cd C:\Users\xxxxxx\Documents\PythonScript

Activate the rem anaconda environment
call activate kaggle_env1

rem password (To-kun), how to use Jupiter without starting the browser
jupyter notebook --NotebookApp.token='password'  --ip=* --no-browser

The content of this post ... Who will benefit ...

Recommended Posts

Python handy batch
Batch design and python
Python
Execute Python script from batch file
Write a batch script with Python3.5 ~
kafka python
Python basics ⑤
python + lottery 6
Built-in python
Python comprehension
Python technique
Studying python
Python 2.7 Countdown
Python memorandum
Python FlowFishMaster
Python service
python function ①
Python basics
Python memo
ufo-> python (3)
Python comprehension
install python
Python Singleton
Python basics ④
Python Memorandum 2
python memo
Python Jinja2
Python increment
python tips
Installing Python 3.4.3.
Try python
Python memo
Python iterative
Python algorithm
[Python] Variables
[Python] Create a Batch environment using AWS-CDK
Python functions
Python sys.intern ()
Python decimals
python underscore
Python summary
Start python
[Python] Sort
Note: Python
Template for writing batch scripts in python
Python basics ③
Python basics
[Scraping] Python scraping
Python update (2.6-> 2.7)
python memo
Python memorandum
Python # sort
ufo-> python
Python nslookup
python learning
Hannari Python 2020
[Rpmbuild] Python 3.7.3.
Prorate Python (1)
python memorandum
Download python
python memorandum