worron / ACYLS

Any Color You Like Simple icon pack
128 stars 10 forks source link

acyls.lib missing #19

Closed k-sz closed 6 years ago

k-sz commented 6 years ago

Hello, after a fresh install of your very tempting program, i have the following issue :

$ python3 ~/.icons/ACYLS/scripts/run.py
Traceback (most recent call last):
  File "/home/ksz/.icons/ACYLS/scripts/run.py", line 23, in <module>
    from acyls.lib.mainwindow import MainWindow
ImportError: No module named 'acyls.lib'

Is there a missing file or is this something i can fix by editing a file ?

Best regards. EDIT I'm no dev, but maybe this has something to do with this part of run.py ?

# Load content of 'scrips' folder as 'acyls' module
# just don't want change current directory structure with 'scrips' and 'scalable' pair
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
import scripts
sys.modules['acyls'] = scripts

# Load main app
from acyls.lib.mainwindow import `MainWindow
worron commented 6 years ago

How do you install program? Can you confirm that ~/.icons/ACYLS/scripts/lib has all the same files as repository?

Can you place this script into ~/.icons/ACYLS/scripts/ run it and check output?

#!/usr/bin/env python3

import os
import sys

print(os.path.abspath(__file__))
dir_ = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")
print(dir_)

sys.path.append(dir_)
import scripts
print(scripts)

try:
    import scripts.lib as test_import
    print(test_import)
except ImportError as e:
    print(e)
k-sz commented 6 years ago

Well - i've tried 3 versions : Opendesktop, github dev and master and 2 methods : download then extract zip with browser and $ git clone in ~/.icons

$ dpkg -s libgtk-3-0|grep '^Version'
Version: 3.22.11-1
$ python3 -V
Python 3.5.3
$ dpkg -s python3-lxml|grep '^Version'
Version: 4.1.0-1~mx17+1

then i simply cd ACYLS/scripts and python3 run.py

~/.icons/ACYLS-master/scripts
$ ls
css  data  filters  gui  __init__.py  lib  preview  run.py  test  tox.ini
$ cd lib
~/.icons/ACYLS-master/scripts/lib
$ ls
altpage.py  colorpage.py  editorpage.py  fssupport.py  guisupport.py   icongroup.py  mainwindow.py   toolbar.py
base.py     data.py       filters.py     gradient.py   iconchanger.py  __init__.py   multithread.py  viewpage.py

i also installed and started tox :

$ tox
> py35 installed: chardet==2.3.0,cupshelpers==1.0,lightdm-gtk-greeter-settings==1.2.1,lxml==4.1.0,mugshot==0.3.1,multibootusb==9.1.0,onboard==1.3.0,pexpect==4.2.1,Pillow==4.0.0,pkg-resources==0.0.0,pluggy==0.4.0,ptyprocess==0.5.1,py==1.4.32,pycups==1.9.73,pycurl==7.43.0,pygobject==3.22.0,pytest==3.0.6,python-apt==1.4.0b3,python-debian==0.1.30,pyudev==0.21.0,reportlab==3.3.0,requests==2.12.4,rpl==1.5.6,six==1.10.0,tox==2.5.0,ufw==0.35,urllib3==1.19.1,vboxapi==1.0,virtualenv==15.1.0
> py35 runtests: PYTHONHASHSEED='2474218863'
> py35 runtests: commands[0] | py.test test -s --ignore=scripts/test/program_data/test_filter_files.py
> ERROR: InvocationError: could not find executable 'py.test'
> flake8 installed: flake8==3.5.0,mccabe==0.6.1,pkg-resources==0.0.0,pycodestyle==2.3.1,pyflakes==1.6.0
> flake8 runtests: PYTHONHASHSEED='2474218863'
> flake8 runtests: commands[0] | flake8
> ______________________________________________________________________ summary ______________________________________________________________________
> ERROR:   py35: commands failed
>   flake8: commands succeeded
> 

HTH !

k-sz commented 6 years ago

The output of your script :

$ ./ACYLtest 
/home/ksz/.icons/ACYLS-master/scripts/ACYLtest
/home/ksz/.icons/ACYLS-master/scripts/..
<module 'scripts' from '/usr/lib/python3/dist-packages/scripts/__init__.py'>
No module named 'scripts.lib'

EDIT multithread.py doesn't have the same permissions as the other libs.

02·03·18|18:26:20|ksz : ~/.icons/ACYLS-master/scripts/lib
$ ls -l
total 88
-rw-r--r-- 1 ksz ksz  2607 oct.  23  2016 altpage.py
-rw-r--r-- 1 ksz ksz   635 oct.  23  2016 base.py
-rw-r--r-- 1 ksz ksz 16194 oct.  23  2016 colorpage.py
-rw-r--r-- 1 ksz ksz  2319 oct.  23  2016 data.py
-rw-r--r-- 1 ksz ksz  3561 oct.  23  2016 editorpage.py
-rw-r--r-- 1 ksz ksz  9909 oct.  23  2016 filters.py
-rw-r--r-- 1 ksz ksz  2320 oct.  23  2016 fssupport.py
-rw-r--r-- 1 ksz ksz  1330 oct.  23  2016 gradient.py
-rw-r--r-- 1 ksz ksz  3106 oct.  23  2016 guisupport.py
-rw-r--r-- 1 ksz ksz  1366 oct.  23  2016 iconchanger.py
-rw-r--r-- 1 ksz ksz  3547 oct.  23  2016 icongroup.py
-rw-r--r-- 1 ksz ksz   413 oct.  23  2016 __init__.py
-rw-r--r-- 1 ksz ksz  4200 oct.  23  2016 mainwindow.py
**-rwxr-xr-x 1 ksz ksz   970 oct.  23  2016 multithread.py**
-rw-r--r-- 1 ksz ksz  1144 oct.  23  2016 toolbar.py
-rw-r--r-- 1 ksz ksz  2078 oct.  23  2016 viewpage.py
worron commented 6 years ago

In file ~/.icons/ACYLS/scripts/run.py can you replace lines

sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
import scripts

with

import imp
scripts = imp.load_source('scripts', os.path.join(os.path.dirname(os.path.abspath(__file__)), "__init__.py"))

and try to launch program?

k-sz commented 6 years ago

Same result as before :

02·03·18|18:43:44|ksz : ~/.icons/ACYLS-master/scripts
$ python3 run.py 
Traceback (most recent call last):
  File "run.py", line 23, in <module>
    from acyls.lib.mainwindow import MainWindow
ImportError: No module named 'acyls.lib'
k-sz commented 6 years ago

Could it be a problem caused by python3-lxml ? It's the only package that isn't from Debian official repos (my OS is MX 17, Debian stable based, no systemd).

worron commented 6 years ago

Seems like you have some system installed python module 'scripts', while my program used to load its local 'scripts' directory as module. Don't you mind also check this script output?

#!/usr/bin/env python3

import os
import sys
import imp

scripts = imp.load_source('scripts', os.path.join(os.path.dirname(os.path.abspath(__file__)), "__init__.py"))
print(scripts)

sys.modules['acyls'] = scripts

try:
    import acyls.lib as test_import
    print(test_import)
except ImportError as e:
    print(e)
k-sz commented 6 years ago

Hop !

$ ./ACYLtest2
<module 'scripts' from '/home/ksz/.icons/ACYLS-master/scripts/__init__.py'>
<module 'acyls.lib' from '/home/ksz/.icons/ACYLS-master/scripts/lib/__init__.py'>
worron commented 6 years ago

OK, seems module loaded correctly. Strange why launch script give the same error.

Here is full fixed 'run.py', try it.

#!/usr/bin/env python3
# -*- Mode: Python; indent-tabs-mode: t; python-indent: 4; tab-width: 4 -*-

import os
import sys
import imp

# Check requirements
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk

if sys.version_info < (3, 4):
    sys.stdout.write("Requires Python 3.x\n")
    sys.exit(1)

# Load content of 'scrips' folder as 'acyls' module
# just don't want change current directory structure with 'scripts' and 'scalable' pair
scripts = imp.load_source('scripts', os.path.join(os.path.dirname(os.path.abspath(__file__)), "__init__.py"))
sys.modules['acyls'] = scripts

# Load main app
from acyls.lib.mainwindow import MainWindow

# Set current working directory to be able use relative path in config
os.chdir(os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))

# Run application
if __name__ == "__main__":
    MainWindow()
    Gtk.main()
k-sz commented 6 years ago

It worked \o/ Thank you for your time and have a nice week-end !

worron commented 6 years ago

Good, thanks for cooperation, I will commit fix to repo sometime soon then.