Python Forum
IndentationError on installed package
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IndentationError on installed package
#1
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!
Reply
#2
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/...' ?
Reply
#3
(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?
Reply
#4
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  when package built, requirements not installed sabuzaki 1 703 Apr-07-2023, 09:01 AM
Last Post: sabuzaki
  IndentationError: unexpected indent dee 3 2,228 May-02-2022, 02:15 AM
Last Post: dee
  error "IndentationError: expected an indented block" axa 4 2,859 Sep-08-2020, 02:09 PM
Last Post: ibreeden
  pip list to show all versions of a package installed pvbadiger05b 4 2,430 May-21-2020, 06:48 PM
Last Post: jameshonest
  Package installed through Anaconda "not found" by Python zonova 0 2,256 May-08-2020, 11:50 PM
Last Post: zonova
  IndentationError: unexpected indent jk91 1 2,339 Feb-27-2020, 08:56 PM
Last Post: buran
  IndentationError jagannath 1 2,436 Nov-04-2019, 07:41 AM
Last Post: buran
  IndentationError: expected an indented block ryder5227 2 2,562 Sep-27-2019, 06:59 PM
Last Post: jefsummers
  Installed Python3.7 from package, trying to run pip3.7 does not work JBristow1729 4 7,469 Aug-11-2019, 08:24 AM
Last Post: michaellossagk
  Problem with importing an installed package Reverend_Jim 4 3,644 Jun-14-2019, 10:20 PM
Last Post: Reverend_Jim

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020