Peppermint OS

Support => Software & Applications => Topic started by: rkkc on September 24, 2020, 12:12:30 pm

Title: sudo apt-get upgrade triggers syntax error - RESOLVED
Post by: rkkc on September 24, 2020, 12:12:30 pm
Hello!

I have run into a problem that has really thrown me for a loop. 
When I install applications via the software manager and the command line I get this error:
Spoiler (click here to view / hide)
[close]

It looks like something is wrong with the mint-adjust.py python file...but I can't figure it out for the life of me.  After reviewing the file, it looks like it might be a difference between python 2 and 3, but update-alternatives only shows python 3.6 as registered...  Honestly, I'm in over my head on this one.  I could just leave it and deal with the error.  Applications still install, it's just the final logging that messes up, but I want it to be right, not just working.

Thanks for any assistance!
Title: Re: sudo apt-get upgrade triggers syntax error
Post by: invisible on September 25, 2020, 02:49:24 am
I think that the clue is in the error message - invalid syntax.
Quote
  File "/usr/lib/linuxmint/mintSystem/mint-adjust.py", line 173
    except Exception,detail:

I had a look at line 173 in the same file on my Peppermint 10 and there is a space missing after Exception,
Code: [Select]
except Exception,detail:
except Exception, detail:

Code: [Select]
sudo nano /usr/lib/linuxmint/mintSystem/mint-adjust.pyNavigate to line 173 and add the space

Save the file and see if you get the same error.

Title: Re: sudo apt-get upgrade triggers syntax error
Post by: rkkc on September 25, 2020, 05:02:35 pm
I did check that out last night, just made the change now again and the same error came up except now it has a space.   :(

Code: [Select]
  File "/usr/lib/linuxmint/mintSystem/mint-adjust.py", line 173
    except Exception, detail:
                    ^
SyntaxError: invalid syntax
dpkg: error processing package peppermint-system (--configure):
 installed peppermint-system package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 peppermint-system
E: Sub-process /usr/bin/dpkg returned an error code (1)
Title: Re: sudo apt-get upgrade triggers syntax error
Post by: invisible on September 26, 2020, 12:48:17 am
Try this in an internet search.
Quote
dpkg: error processing package peppermint-system (--configure):

Quite a few replies to peruse (including some from Peppermint forums)

Possibly, it is a case of removing and purging the offending package and then re-installing.

However, please tread carefully with system packages and please make sure you have back-ups.

Title: Re: sudo apt-get upgrade triggers syntax error
Post by: rkkc on September 26, 2020, 07:07:00 am
I followed a guide on removing peppermint-system and purging related files.  I did NOT restart prior to reinstalling and it is throwing the same error.  I'm fairly convinced it has something to do with the python code in mint-adjust.py...  I just tried two things:

Code: [Select]
sudo python2 /usr/lib/linuxmint/mintSystem/mint-adjust.pyReturns nothing

Code: [Select]
sudo python /usr/lib/linuxmint/mintSystem/mint-adjust.pyReturns the error:
Code: [Select]
  File "/usr/lib/linuxmint/mintSystem/mint-adjust.py", line 173
    except Exception, detail:
                    ^
SyntaxError: invalid syntax

Title: Re: sudo apt-get upgrade triggers syntax error
Post by: rkkc on September 26, 2020, 07:22:53 am
GOT IT!   :D

It was the python interpreter.  Installed it in update alternatives and changed python to default to python2.

Code: [Select]
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 1
Code: [Select]
sudo update-alternatives --config python
Feel a little dumb, but I'm glad I went through this and didn't give up or just reinstall.  :)  Honestly, this is one thing I love about Linux.  You break it, you fix it, you learn along the way.  WOO!

Thank you all for assisting!
Title: Re: sudo apt-get upgrade triggers syntax error - RESOLVED
Post by: straybit on September 26, 2020, 07:28:30 am
I was going to suggest that the caret was pointing to what looked like a comma to my aged eyes and perhaps it should have been a period.
Glad you got it resolved anyway.
Bruce
Title: Re: sudo apt-get upgrade triggers syntax error
Post by: VinDSL on September 26, 2020, 10:11:50 am
I'm glad I went through this and didn't give up or just reinstall.  :)  Honestly, this is one thing I love about Linux.  You break it, you fix it, you learn along the way.  WOO!

Good job, Detective rkkc!   :)