Python Forum
IndentationError on installed package - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: IndentationError on installed package (/thread-19450.html)



IndentationError on installed package - evvvonder - Jun-29-2019

I'm new to python and have been working on a code to take timelapse photographs, with this at the top of the code:
from time import sleep
from datetime import datetime

from sh import gphoto2 as gp
import signal, os, subprocess
the iterations up until this one have been working, however now when I run it I get this error:
Error:
Traceback (most recent call last): File "earth_test_7.py", line 4, in <module> from sh import gphoto2 as gp File "usr/local/lib/python3.4/dist-packages/sh.py", line 1 PWD=/home/pi ; USER=root ; COMMAND=/bin/date =s @1488917643 ^ IndentationError: unexpected indent
I'n confused as to how to resolve this as I haven't changed the downloaded package since installing it. A previous iteration was working earlier today, but now gives me the same error message.
I tried upgrading sh.py but the requirements are already up to date.

Thanks!


RE: IndentationError on installed package - Gribouillis - Jun-29-2019

PWD=/home/pi ; USER=root ; COMMAND=/bin/date =s @1488917643
This is not python code. You've probably overwritten usr/local/lib/python3.4/dist-packages/sh.py. By the way, why is it 'usr/local...' instead of '/usr/local/...' ?


RE: IndentationError on installed package - evvvonder - Jun-29-2019

(Jun-29-2019, 10:23 PM)Gribouillis Wrote:
PWD=/home/pi ; USER=root ; COMMAND=/bin/date =s @1488917643
This is not python code. You've probably overwritten usr/local/lib/python3.4/dist-packages/sh.py. By the way, why is it 'usr/local...' instead of '/usr/local/...' ?


It is '/usr/local/...' , must have been a typo on my part, apologies

If I've overwritten it, what's the best way to go about fixing that? Do I need to uninstall and reinstall?


RE: IndentationError on installed package - Gribouillis - Jun-29-2019

If sh was installed with pip, try
Output:
python3.4 -m pip uninstall sh
Check that sh.py is not there anymore, then
Output:
python3.4 -m pip install sh