C2N14 / AutomaThemely

Simple, set-and-forget python application for changing between desktop themes according to light and dark hours
GNU General Public License v3.0
206 stars 31 forks source link

Can't run #49

Open ravenomeo opened 4 years ago

ravenomeo commented 4 years ago

There's a bug in the code. The updsuntimes.py script tries to import Location.py, but the module is saved as "location.py" which gives an importation error. Simply due to Uppercase and Lowercase management(L and l). You can change every instance of Location to location, or you can just rename location.py to Location.py(Don't know if the latter works though.

Edit: So after fixing that in mine, turns out when you run automathemely from terminal, you get a "Module not callable error" from line 66 of updsuntimes.py (location=Location()). I fixed this by changing it to (location=Location.Location()). Hope this helps

Littleweisheit commented 4 years ago

I still cant work Traceback (most recent call last): File "/usr/bin/automathemely", line 33, in sys.exit(load_entry_point('AutomaThemely==1.3', 'console_scripts', 'automathemely')()) File "/usr/lib/python3.8/site-packages/automathemely/bin/run.py", line 80, in main automathemely.autoth_tools.argmanager.main(user_settings) File "/usr/lib/python3.8/site-packages/automathemely/autoth_tools/argmanager.py", line 99, in main from . import settsmanager File "/usr/lib/python3.8/site-packages/automathemely/autoth_tools/settsmanager.py", line 4, in gi.require_version('Gtk', '3.0') AttributeError: module 'gi' has no attribute 'require_version'

ravenomeo commented 4 years ago

What version of python do you have and what distro are you running it on?

Littleweisheit commented 4 years ago

What version of python do you have and what distro are you running it on?

I am using arch linux

VasLem commented 4 years ago

yes Location has been renamed to LocationInfo

ravenomeo commented 4 years ago

Alright. 👍

ordy commented 4 years ago

Managed to run it on arch after replacing all the location with Location in /usr/lib/python3.8/site-packages/automathemely/autoth_tools/updsuntimes.py

But now I'm getting a sun_times error when running the application from terminal:

  File "/usr/lib/python3.8/site-packages/automathemely/bin/run.py", line 96, in main
    with open(get_local('sun_times'), 'rb') as file:
FileNotFoundError: [Errno 2] No such file or directory: '/home/<username>/.config/automathemely/sun_times'

Edit:

Think I got it running now. In autoth_tools/updsuntimes.py

Now I got my sun_times in .config folder and my theme changed to the light variant.

Oh, just noticed that the pending PR https://github.com/C2N14/AutomaThemely/pull/41 does exactly the same thing :sweat_smile:

ravenomeo commented 4 years ago

Lol. I'm glad we all got it to work in the end

Littleweisheit commented 4 years ago

Managed to run it on arch after replacing all the location with Location in /usr/lib/python3.8/site-packages/automathemely/autoth_tools/updsuntimes.py

But now I'm getting a sun_times error when running the application from terminal:

  File "/usr/lib/python3.8/site-packages/automathemely/bin/run.py", line 96, in main
    with open(get_local('sun_times'), 'rb') as file:
FileNotFoundError: [Errno 2] No such file or directory: '/home/<username>/.config/automathemely/sun_times'

Edit:

Think I got it running now. In autoth_tools/updsuntimes.py

* Reverted my previous changes from `Location` to `location`

* imported `from astral import LocationInfo` like suggested above

* imported `from astral.sun import sun`

* changed line 66 `location = Location()` to `location = LocationInfo()`

* changed line 76 and 77
sunrise = location.sun()['sunrise'].replace(second=0) + timedelta(minutes=us_se['offset']['sunrise'])
sunset = location.sun()['sunset'].replace(second=0) + timedelta(minutes=us_se['offset']['sunset'])

to

sunrise = sun(location.observer)['sunrise'].replace(second=0) + timedelta(minutes=us_se['offset']['sunrise'])
sunset = sun(location.observer)['sunset'].replace(second=0) + timedelta(minutes=us_se['offset']['sunset'])

Now I got my sun_times in .config folder and my theme changed to the light variant.

Oh, just noticed that the pending PR #41 does exactly the same thing sweat_smile

I do as you say still dont work.But I install python-gobject(sudo pacman -S python-gobject),Its finally worked.

Mennaruuk commented 4 years ago

Unfortunately, I tried doing everything on this page, but alas, nothing worked. AutomaThemely refuses to run. I'm currently on Manjaro (XFCE) 20.1.2. Can an update fix this issue?

mystiquewolf commented 3 years ago

I do as you say still dont work.But I install python-gobject(sudo pacman -S python-gobject), Its finally worked.

Still got the ImportError: cannot import name '_gi' This is with the replaced file from pull request #41 I'm giving up and subscribing here.

gitgnmn commented 2 years ago

I do as you say still dont work.But I install python-gobject(sudo pacman -S python-gobject), Its finally worked.

* In Ubuntu repos python-gobject seems to be for python 2.7.

* There is a package python3-gi which i believe is the python 3 alternative, which is installed by default in Ubuntu 20.04

* I also tried `python3.6 -m pip install --user pygobject` but it also is already installed.

Still got the ImportError: cannot import name '_gi' This is with the replaced file from pull request #41 I'm giving up and subscribing here.

You can fix this by changing gi to pgi and installing pgi in your venv. As long as the problem is that it can't find the gi module (you mention '_gi'?). I think this should bypass any need for other packages for gi functionality. Not sure what the pros and cons are with this solution compared to using system dependencies and continue using gi though.

Edit: Just saw the date... I'll leave this here if anyone else stumbles through.

tio-trom commented 2 years ago

Same here cannot start it

~ >>> automathemely                                                            
Traceback (most recent call last):
  File "/usr/bin/automathemely", line 33, in <module>
    sys.exit(load_entry_point('AutomaThemely==1.3', 'console_scripts', 'automathemely')())
  File "/usr/lib/python3.10/site-packages/automathemely/bin/run.py", line 29, in main
    from automathemely.autoth_tools import argmanager, extratools, envspecific, updsuntimes
  File "/usr/lib/python3.10/site-packages/automathemely/autoth_tools/updsuntimes.py", line 8, in <module>
    from astral import Location
ImportError: cannot import name 'Location' from 'astral' (/usr/lib/python3.10/site-packages/astral/__init__.py)