[toss] Python + GitHub Actions update Z-Blog exploration

Posted by Tim L on Wed, 10 Nov 2021 14:20:32 +0100

preface

The reason is to see this project:

Zhaoole / WordPress xmlrpctools: manage WordPress in Hexo mode
https://github.com/zhaoolee/WordPressXMLRPCTools

I want to get a for Z-Blog, but ZB's XML-RPC interface is incomplete, and the upcoming version 1.7 will come with its own API. Let's go to the API. However, the question is when will 1.7 be released?

In the process of tossing and turning, it has also solved various problems. However, it is a little melancholy that it can't sort out the records at every point..

Python one

Because the system has been reinstalled recently, Python or something needs to be reinstalled..

[[before reloading, there was also a Python project to turn pictures into sketch style, which was useless to me, and the actual effect was a little worse than that of demonstration]]

[[let's also have a toss note, which can be published with the current tool]]

Although Python can be easily downloaded from the Microsoft Store, it is not very convenient to use.

Here are some explorations. Docker For Windows is the same.

In short, Permission denied will be prompted when Python is executed in Git bash or VSCode terminal, so winpty needs to be added. There is also an option of "application execution alias" that can be set as needed.

python -V
# bash: /c/Users/****/AppData/Local/Microsoft/WindowsApps/python: Permission denied

winpty python -V
# Python 3.7.9

Well, it is recommended to install Python directly and separately... The store version can only be used under cmd, pip and other troubles.

Python II

In addition, about VSCode, autopep8 cannot be installed for code formatting.

The prompt is similar to this:

C:\Users\wdssm\AppData\Local\Programs\Python\Python37\python.exe: can't open file 'c:Userswdssm.vscodeextensionsms-python.python-2021.1.502429796pythonFilespyvsc-run-isolated.py': [Errno 2] No such file or directory

Resolution: execute in cmd:

C:\Users\wdssm\AppData\Local\Programs\Python\Python37\python.exe \
C:\Users\wdssm\.vscode\extensions\ms-python.python-2021.1.502429796\pythonFiles\pyvsc-run-isolated.py pip install -U autopep8

C:\Users\wdssm\AppData\Local\Programs\Python\Python37\python.exe \
C:\Users\wdssm\.vscode\extensions\ms-python.python-2021.1.502429796\pythonFiles\pyvsc-run-isolated.py pip install -U pylint --user

The path needs to be modified according to the actual situation.

I don't understand, but it doesn't have any impact

↓ I don't know how to use this thing locally. GitHub Actions succeeded after more than 30 attempts.

pip install pipenv
pip install -p Pipfile.lock

In fact, it did not solve the required part

Exploration of getting the real modification time of files in Github Actions:

GIT gets the date when the file was originally created and last modified · Issue #69 · dream4ever / knowledge base

_cache_logs="_cache_logs.json"
echo  "{" > ${_cache_logs};
git ls-tree -r --name-only HEAD | while read filename; do
if [ "${filename##*.}"x = "md"x ];then
echo "\"$(git log -1 --pretty=format:"%at" -- $filename)\": \"$filename\",";
echo "\"$(git log -1 --pretty=format:"%at" -- $filename)\": \"$filename\"," >> ${_cache_logs};
fi
done
echo  "\"0\":\"README.md\"" >> ${_cache_logs};
echo  "}" >> ${_cache_logs};
#

↑ failed. The time obtained in the online environment is the same.

There is an error prompt in the middle: bash: ${var}: ambiguous redirect. I checked it for a long time, but I finally forgot the reason (╯ ﹏).

Conclusion: it seems difficult to use git diff instead. Change to "File Changes Action";

The last part

# _test="aaa"
export _test="aaa"
python test.py
# import os
# print(os.environ["_test"])

Original link: https://www.wdssmq.com/post/20210129918.html

Manhole cover password: "my salted fish heart"

WeChat official account: "water does not want to say".

Topics: github