Die Suche ergab 7 Treffer

von LetzterZucker
Montag 27. Februar 2023, 19:11
Forum: Allgemeine Fragen
Thema: crontab, utf8 und python3 Problem
Antworten: 19
Zugriffe: 1988

Re: crontab, utf8 und python3 Problem

zu den Leerzeichen:
was nicht erlaubt ist wird wohl sofort bemeckert....
Das geht:
TERM=xterm
PYTHONIOENCODING=UTF-8
LANG=de_DE.UTF-8
#LC_ALL=de_DE.UTF-8
# m h dom mon dow command
*/3 * * * * ./cearg.py 10 >> xyz.log 2>&1
*/4 * * * * ./qas.py >> qas.log 2>&1
*/30 * * * * ~/.local/bin/atsetter/ce ...
von LetzterZucker
Montag 27. Februar 2023, 18:06
Forum: Allgemeine Fragen
Thema: crontab, utf8 und python3 Problem
Antworten: 19
Zugriffe: 1988

Re: crontab, utf8 und python3 Problem

Der Fehler hat wohl nichts mit den locals zu tun.

Cron <root@localhost> root cd / && run-parts --report /etc/cron.hourly
/bin/bash: root: Befehl nicht gefunden

zwischenzeitlich habe ich bemerkt, dass -warum auch immer- die root crontab die gleichen Einträge wie die /etc/crontab enthält
nämlich ...
von LetzterZucker
Montag 27. Februar 2023, 14:15
Forum: Allgemeine Fragen
Thema: crontab, utf8 und python3 Problem
Antworten: 19
Zugriffe: 1988

Re: crontab, utf8 und python3 Problem

Es funktioniert,
Dank Euch allen!

User crontab:

PYTHONIOENCODING=UTF-8
LANG=de_DE.UTF-8
# m h dom mon dow command
*/3 * * * * ./xyz.py >> xyz.log 2>&1


/etc/crontab:

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user command
MAILTO = "cek ...
von LetzterZucker
Samstag 25. Februar 2023, 11:59
Forum: Allgemeine Fragen
Thema: crontab, utf8 und python3 Problem
Antworten: 19
Zugriffe: 1988

Re: crontab, utf8 und python3 Problem

@snafu "1968" .... Ich habs befürchtet!
@heyJo Windows darf hier nicht mehr mitspielen...
@deets "- fc ist der Code point für ü" -fc? fcrontab?

Python3:

#!/usr/bin/python3

import sys

print(sys.stdout.encoding)
print('wilder Süden')

fcrontab:

@ 2 python3 xyz.py >> ~/xyz.log 2>&1
@ 2 echo ...
von LetzterZucker
Samstag 25. Februar 2023, 09:53
Forum: Allgemeine Fragen
Thema: crontab, utf8 und python3 Problem
Antworten: 19
Zugriffe: 1988

Re: crontab, utf8 und python3 Problem

Code: Alles auswählen

cek@localhost:~$ python3 xyz.py
wilder Süden

cek@localhost:~$ which python3
/usr/bin/python3
cek@localhost:~$ export PYTHONIOENCODING=UTF-8

cek@localhost:~$ python3 --version
Python 3.6.9

von LetzterZucker
Samstag 25. Februar 2023, 01:30
Forum: Allgemeine Fragen
Thema: crontab, utf8 und python3 Problem
Antworten: 19
Zugriffe: 1988

Re: crontab, utf8 und python3 Problem

Python3 (etwas eingedampft...)

#!/usr/bin/python3
# -*- coding: utf-8 -*-

print('wilder Süden')

fcrontab (alle 2 Minuten..):

@ 2 python3 xyz.py

/var/mail/cek:

Traceback (most recent call last):
File "xyz.py", line 4, in <module>
print('wilder S\xfcden')
UnicodeEncodeError: 'ascii' codec ...
von LetzterZucker
Samstag 25. Februar 2023, 00:23
Forum: Allgemeine Fragen
Thema: crontab, utf8 und python3 Problem
Antworten: 19
Zugriffe: 1988

crontab, utf8 und python3 Problem

Hallo Leute,
habe auf einem Ubuntu Server 18.04 ein Python3 Script welches sich einwandfrei mit der shell
ausführen lässt:
./xyz.py -p
In der Ausgabe ist ein Umlaut enthalten.

Shebang und Codierung vorhanden, Rechte gesetzt:

#!/usr/bin/python3
# -*- coding: utf-8 -*-


Wird das gleiche ...