pythonで、ログ表示やデバック時に使う、行番号、関数名、ファイル名を表示 Python

pythonで、ログ表示やデバック時に使う、行番号、関数名、ファイル名を表示
sys._getfram()でするよ

<div class= code >import sys

print(sys._getframe().f_code.co_filename) # ok ファイル名
print(sys._getframe().f_line

  2020-02-2 09:41:00

pythonで AttributeError: &apos;dict&apos; object has no attribute &apos;dumps&apos; のエラーではまる Python

pythonで
AttributeError: dict object has no attribute dumps
のエラーではまる

import json
print( &#123;&#125; .format(json.dumps(dictdata indent=4)))

このファイルを実行すると
A

  2020-02-1 11:39:57

pythonのBeautifulSoupをつかって、繰り返し現れる情報から、その階層化にある情報を個別に取り出す Python

pythonのBeautifulSoupをつかって、繰り返し現れる情報から、その階層化にある情報を個別に取り出す例
class_= article という階層下にタイトルと、リンク先と、時間が現れるのでそれを同時に取り出す


以下で取得できた
<div class= syntaxhighlighter >url = 対象URL

  2020-02-1 05:04:00

mongodbが Failed to start SYSV: Mongo is a scalable document-oriented database..とか、exception in initAndListen: 15926 Insufficient free space for journals terminating のメッセージがでて落ちてしまって起動できなかったやつ mongodb

mongodbが Failed to start SYSV: Mongo is a scalable document-oriented database..とか、exception in initAndListen: 15926 Insufficient free space for journals terminating
のメッセージがでて落ちてしまって起動できなかったやつ<b

  2020-01-31 11:26:00

docker build 中にエラー registry-1.docker.io/v2/: remote error: tls: handshake failure docker

dockerfile作成してbuild中にエラー発生

>docker build -t pytest .
Sending build context to Docker daemon 3.072kB
Step 1/9 : FROM python:3.6
Get https://registry-1.docker.io/v2/: remote e

  2020-01-14 06:41:20

pythonで #UnicodeEncodeError: &apos;cp932&apos; codec can&apos;t encode character ~: illegal multibyte sequence に対処した Python

ファイル開く時にutf8指定しなかったばっかりに出たエラー
#UnicodeEncodeError: cp932 codec can t encode character &yen;u200c in position 274: illegal multibyte sequence

解決策
with open(path mode= w enco

  2019-12-22 19:17:33

dockerでこのエラーでた ERROR: Couldn&apos;t connect to Docker daemon at http+docker://localhost - is it running? If it&apos;s at a non-standard location specify the URL with the DOCKER_HOST environment variable. docker

単純にdockerデーモンが起動してない状況でした

# /usr/local/bin/docker-compose build
ERROR: Couldn t connect to Docker daemon at http+docker://localhost - is it running?

If it s at a non-standar

  2019-12-17 09:38:07

2019年買って本当によかったものが流行っているようなので、紹介してみる。これ → 仕事中にまわり音がうるさい騒音問題を解決してくれたグッズ イヤホン

2019年買って本当によかったものが流行っているようなので、紹介してみる。これ → 仕事中にまわり音がうるさい騒音問題を解決してくれたグッズ

<a target= _blank href= https://www.amazon.co.jp/gp/product/B07HHVQPZF/ref=as_li_tl?ie=UTF8&camp=247&creative=1211&c

  2019-12-12 08:46:00

docker使おうとしたらCannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?って怒られたので起動したった docker

dockerを起動する

# docker ps -a
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
#

あれ、起動してなかったわい

# systemctl sta

  2019-12-11 06:07:39

laravelでpost使うと419 (unknown status) のエラーがでてうまくいかなかったことの対策 Laravel

laravelでpost使うと419 (unknown status) のエラーがでてうまくいかなかったことの対策

Laravel で Formを作成しボタン押してpost送信すると
419 エラーが発生。
Sorry your session has expired. Please refresh and try again

原因

  2019-12-6 10:40:00