Hey,
ich möchte das wenn das Signal High ist eine E-Mail senden. Nun habe ich nach pythonMailer geschaut und bin auf python-simplemail (
https://github.com/gerold-penz/python-simplemail/) gestoßen. Nun wenn ich versuche, mit dem Code der bei der Installation steht (pip install python-simplemail), simplemail auf dem Pi zu installieren erhalte ich diesen Fehler:
------------------------------------------------------------
/usr/bin/pip run on Thu Dec 21 16:41:42 2017
Downloading/unpacking python-simplemail
Getting page
https://pypi.python.org/simple/python-simplemail/
URLs to search for versions for python-simplemail:
*
https://pypi.python.org/simple/python-simplemail/
Analyzing links from page
https://pypi.python.org/simple/python-simplemail/
Found link
https://pypi.python.org/packages/21/d8/ ... fa0a4e73cf (from
https://pypi.python.org/simple/python-simplemail/), version: 2.0.4
Found link
https://pypi.python.org/packages/38/28/ ... 263100e759 (from
https://pypi.python.org/simple/python-simplemail/), version: 2.0.2
Found link
https://pypi.python.org/packages/8d/db/ ... 6bfa58f420 (from
https://pypi.python.org/simple/python-simplemail/), version: 2.1.0
Found link
https://pypi.python.org/packages/e7/66/ ... 6af10a70b0 (from
https://pypi.python.org/simple/python-simplemail/), version: 2.0.3
Using version 2.1.0 (newest of versions: 2.1.0, 2.0.4, 2.0.3, 2.0.2)
Downloading python-simplemail-2.1.0.tar.gz
Downloading from URL
https://pypi.python.org/packages/8d/db/ ... 6bfa58f420 (from
https://pypi.python.org/simple/python-simplemail/)
Running setup.py (path:/tmp/pip-build-jWJlNo/python-simplemail/setup.py) egg_info for package python-simplemail
running egg_info
creating pip-egg-info/python_simplemail.egg-info
writing pip-egg-info/python_simplemail.egg-info/PKG-INFO
writing top-level names to pip-egg-info/python_simplemail.egg-info/top_level.txt
writing dependency_links to pip-egg-info/python_simplemail.egg-info/dependency_links.txt
writing manifest file 'pip-egg-info/python_simplemail.egg-info/SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
reading manifest file 'pip-egg-info/python_simplemail.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'lgpl-3.0.txt'
warning: no files found matching 'mit-license.txt'
warning: no files found matching 'mit-lizenz-deutsch.txt'
warning: no files found matching '*' under directory 'examples'
writing manifest file 'pip-egg-info/python_simplemail.egg-info/SOURCES.txt'
Source in /tmp/pip-build-jWJlNo/python-simplemail has version 2.1.0, which satisfies requirement python-simplemail
Installing collected packages: python-simplemail
Running setup.py install for python-simplemail
Running command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-jWJlNo/python-simplemail/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-wTx3NP-record/install-record.txt --single-version-externally-managed --compile
running install
running build
running build_py
creating build
creating build/lib.linux-armv7l-2.7
creating build/lib.linux-armv7l-2.7/simplemail
copying simplemail/__init__.py -> build/lib.linux-armv7l-2.7/simplemail
running install_lib
creating /usr/local/lib/python2.7/dist-packages/simplemail
error: could not create '/usr/local/lib/python2.7/dist-packages/simplemail': Permission denied
Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-jWJlNo/python-simplemail/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-wTx3NP-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-armv7l-2.7
creating build/lib.linux-armv7l-2.7/simplemail
copying simplemail/__init__.py -> build/lib.linux-armv7l-2.7/simplemail
running install_lib
creating /usr/local/lib/python2.7/dist-packages/simplemail
error: could not create '/usr/local/lib/python2.7/dist-packages/simplemail': Permission denied
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-jWJlNo/python-simplemail/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-wTx3NP-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip-build-jWJlNo/python-simplemail
Exception information:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 295, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1436, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 707, in install
cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
File "/usr/lib/python2.7/dist-packages/pip/util.py", line 716, in call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-jWJlNo/python-simplemail/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-wTx3NP-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip-build-jWJlNo/python-simplemail
Und wenn ich das pythonscript in der Kommandozeile ausführe dann kommt folgender Fehler:
Traceback (most recent call last):
File "programme/ofen.py", line 5, in <module>
from simplemail import Email
ImportError: No module named simplemai
Mein Script:
Code: Alles auswählen
#!/usr/bin/python
# -*- coding: utf8 -*-
import RPi.GPIO as GPIO
from simplemail import Email
# Benötigte Werte:
# GPIO.LOW (alles ok)
# GPIO.HIGH (fehler)
#GPIO.setmode(GPIO.BOARD); # Pin-Nummern aus dem Layout benutzen (siehe gpio.jpg)
# input setzen auf Pin-Nummer: 18 = GPIO 24
#GPIO.setup(18, GPIO.IN);
signal = "high"
#Überprüfung ob input einen low oder high status hat
#GPIO.input(18) == GPIO.HIGH
if signal == "high":
# Mailversand
Email(
from_address = "test@test.de",
smtp_server = "smtp.gmail.com",
to_address = "test@test.de",
subject = "Einfaches Beispiel (öäüß)",
message = "Das ist der Nachrichtentext mit Umlauten (öäüß)",
).send()
print "Fertig"
else:
print "Signal is not high"
Das heißt die Installation schlug fehl. Aber was kann ich dagegen machen ? Hat jemand schon Erfahrungen damit?