hschauhan / gosync

An Opensource Google Drive client written in Python
https://hschauhan.github.io/gosync/
GNU General Public License v2.0
283 stars 57 forks source link

ModuleNotFoundError: No module named 'GoSyncController' #25

Closed SGmuwa closed 4 years ago

SGmuwa commented 4 years ago

Reproducing

https://github.com/hschauhan/gosync/issues/12#issuecomment-623208689

$ pip install --user GoSync
Collecting GoSync
  Using cached GoSync-0.4-py2.py3-none-any.whl (154 kB)
Requirement already satisfied: google-api-python-client in ./.local/lib/python3.8/site-packages (from GoSync) (1.8.2)
Requirement already satisfied: pydrive in ./.local/lib/python3.8/site-packages (from GoSync) (1.3.1)
Requirement already satisfied: watchdog in ./.local/lib/python3.8/site-packages (from GoSync) (0.10.2)
Requirement already satisfied: six<2dev,>=1.6.1 in /usr/lib/python3/dist-packages (from google-api-python-client->GoSync) (1.14.0)
Requirement already satisfied: httplib2<1dev,>=0.9.2 in /usr/lib/python3/dist-packages (from google-api-python-client->GoSync) (0.14.0)
Requirement already satisfied: google-auth>=1.4.1 in ./.local/lib/python3.8/site-packages (from google-api-python-client->GoSync) (1.14.1)
Requirement already satisfied: google-api-core<2dev,>=1.13.0 in ./.local/lib/python3.8/site-packages (from google-api-python-client->GoSync) (1.17.0)
Requirement already satisfied: google-auth-httplib2>=0.0.3 in ./.local/lib/python3.8/site-packages (from google-api-python-client->GoSync) (0.0.3)
Requirement already satisfied: uritemplate<4dev,>=3.0.0 in ./.local/lib/python3.8/site-packages (from google-api-python-client->GoSync) (3.0.1)
Requirement already satisfied: oauth2client>=4.0.0 in ./.local/lib/python3.8/site-packages (from pydrive->GoSync) (4.1.3)
Requirement already satisfied: PyYAML>=3.0 in /usr/lib/python3/dist-packages (from pydrive->GoSync) (5.3.1)
Requirement already satisfied: pathtools>=0.1.1 in ./.local/lib/python3.8/site-packages (from watchdog->GoSync) (0.1.2)
Requirement already satisfied: setuptools>=40.3.0 in /usr/lib/python3/dist-packages (from google-auth>=1.4.1->google-api-python-client->GoSync) (45.2.0)
Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/lib/python3/dist-packages (from google-auth>=1.4.1->google-api-python-client->GoSync) (0.2.1)
Requirement already satisfied: cachetools<5.0,>=2.0.0 in ./.local/lib/python3.8/site-packages (from google-auth>=1.4.1->google-api-python-client->GoSync) (4.1.0)
Requirement already satisfied: rsa<4.1,>=3.1.4 in ./.local/lib/python3.8/site-packages (from google-auth>=1.4.1->google-api-python-client->GoSync) (4.0)
Requirement already satisfied: pytz in ./.local/lib/python3.8/site-packages (from google-api-core<2dev,>=1.13.0->google-api-python-client->GoSync) (2019.3)
Requirement already satisfied: googleapis-common-protos<2.0dev,>=1.6.0 in ./.local/lib/python3.8/site-packages (from google-api-core<2dev,>=1.13.0->google-api-python-client->GoSync) (1.51.0)
Requirement already satisfied: requests<3.0.0dev,>=2.18.0 in /usr/lib/python3/dist-packages (from google-api-core<2dev,>=1.13.0->google-api-python-client->GoSync) (2.22.0)
Requirement already satisfied: protobuf>=3.4.0 in ./.local/lib/python3.8/site-packages (from google-api-core<2dev,>=1.13.0->google-api-python-client->GoSync) (3.11.3)
Requirement already satisfied: pyasn1>=0.1.7 in /usr/lib/python3/dist-packages (from oauth2client>=4.0.0->pydrive->GoSync) (0.4.2)
Installing collected packages: GoSync
Successfully installed GoSync-0.4

$ GoSync
Traceback (most recent call last):
  File "/home/sgmuwa/.local/bin/GoSync", line 5, in <module>
    from GoSync.GoSync import main
  File "/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/GoSync.py", line 20, in <module>
    import sys, os, wx, GoSyncController, GoSyncModel
ModuleNotFoundError: No module named 'GoSyncController'

Files

$ sudo find / | grep GoSync
/home/sgmuwa/.local/bin/GoSync
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/GoSyncSettingsPage.py
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/__init__.py
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/GoSyncController.py
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/DriveUsageBox.py
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/resources
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/resources/GoSyncIcon-16.png
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/resources/user.png
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/resources/usage.png
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/resources/settings.png
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/resources/GoSyncIcon-64.png
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/resources/exit.png
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/resources/GoSyncIcon.png
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/resources/sync-menu.png
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/resources/info.png
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/resources/GoSyncIcon-32.png
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/GoSyncDriveTree.py
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/GoSyncEvents.py
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/__pycache__
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/__pycache__/__init__.cpython-38.pyc
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/__pycache__/DriveUsageBox.cpython-38.pyc
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/__pycache__/GoSyncSettingsPage.cpython-38.pyc
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/__pycache__/GoSyncController.cpython-38.pyc
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/__pycache__/GoSyncDriveTree.cpython-38.pyc
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/__pycache__/GoSyncEvents.cpython-38.pyc
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/__pycache__/GoSync.cpython-38.pyc
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/__pycache__/defines.cpython-38.pyc
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/GoSyncModel.py
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/GoSync.py
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/defines.py
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync-0.4.dist-info
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync-0.4.dist-info/DESCRIPTION.rst
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync-0.4.dist-info/RECORD
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync-0.4.dist-info/METADATA
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync-0.4.dist-info/metadata.json
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync-0.4.dist-info/entry_points.txt
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync-0.4.dist-info/INSTALLER
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync-0.4.dist-info/WHEEL
/home/sgmuwa/.local/lib/python3.8/site-packages/GoSync-0.4.dist-info/top_level.txt

$ cat /home/sgmuwa/.local/bin/GoSync
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import re
import sys
from GoSync.GoSync import main
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(main())

$ cat /home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/GoSync.py
#!/usr/bin/python
# gosync is an open source google drive sync application for Linux
#
# Copyright (C) 2015 Himanshu Chauhan
# 
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

import sys, os, wx, GoSyncController, GoSyncModel
from os.path import expanduser, dirname, relpath
from GoSyncController import GoSyncController
from defines import *

# Add the current path to gosync path.
sys.path.insert(0, APP_PATH)

def main():
    os.chdir(APP_PATH)
    app = wx.PySimpleApp()
    controller = GoSyncController()
    controller.Center()
    controller.Show()
    app.MainLoop()

if __name__ == "__main__":
    main()

$ cat /home/sgmuwa/.local/lib/python3.8/site-packages/GoSync/GoSyncController.py
# gosync is an open source Google Drive(TM) sync application for Linux
#
# Copyright (C) 2015 Himanshu Chauhan
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

import wx, os, time
import sys, os, wx, ntpath, defines, threading, math, webbrowser
from GoSyncModel import GoSyncModel, ClientSecretsNotFound
from defines import *
from threading import Timer
from DriveUsageBox import DriveUsageBox
from GoSyncEvents import *
from GoSyncSettingsPage import SettingsPage

ID_SYNC_TOGGLE = wx.NewId()

mainWindowStyle = wx.DEFAULT_FRAME_STYLE & (~wx.CLOSE_BOX) & (~wx.MAXIMIZE_BOX)
HERE=os.path.abspath(os.path.dirname(__file__))

class PageAccount(wx.Panel):
    def __init__(self, parent, sync_model):
        wx.Panel.__init__(self, parent, size=parent.GetSize())

        self.sync_model = sync_model
        self.totalFiles = 0

        aboutdrive = sync_model.DriveInfo()
        self.driveUsageBar = DriveUsageBox(self, long(aboutdrive['quotaBytesTotal']), -1)
        self.driveUsageBar.SetStatusMessage("Calculating your categorical Google Drive usage. Please wait.")
        self.driveUsageBar.SetMoviesUsage(0)
        self.driveUsageBar.SetDocumentUsage(0)
        self.driveUsageBar.SetOthersUsage(0)
        self.driveUsageBar.SetAudioUsage(0)
        self.driveUsageBar.SetPhotoUsage(0)
        self.driveUsageBar.RePaint()

        mainsizer = wx.BoxSizer(wx.VERTICAL)

        self.SetSizerAndFit(mainsizer)

        GoSyncEventController().BindEvent(self, GOSYNC_EVENT_CALCULATE_USAGE_STARTED,
                                          self.OnUsageCalculationStarted)
        GoSyncEventController().BindEvent(self, GOSYNC_EVENT_CALCULATE_USAGE_DONE,
                                          self.OnUsageCalculationDone)
        GoSyncEventController().BindEvent(self, GOSYNC_EVENT_CALCULATE_USAGE_UPDATE,
                                          self.OnUsageCalculationUpdate)

    def OnUsageCalculationDone(self, event):
        if not event.data:
            self.driveUsageBar.SetStatusMessage("Your Google Drive usage is shown below:")
            self.driveUsageBar.SetMoviesUsage(self.sync_model.GetMovieUsage())
            self.driveUsageBar.SetDocumentUsage(self.sync_model.GetDocumentUsage())
            self.driveUsageBar.SetOthersUsage(self.sync_model.GetOthersUsage())
            self.driveUsageBar.SetAudioUsage(self.sync_model.GetAudioUsage())
            self.driveUsageBar.SetPhotoUsage(self.sync_model.GetPhotoUsage())
            self.driveUsageBar.RePaint()
        else:
            self.driveUsageBar.SetStatusMessage("Sorry, could not calculate your Google Drive usage.")

    def OnUsageCalculationUpdate(self, event):
        percent = (event.data * 100)/self.totalFiles
        self.driveUsageBar.SetStatusMessage("Calculating your categorical usage... (%d%%)\n" % percent)

    def OnUsageCalculationStarted(self, event):
        self.totalFiles = event.data
        self.driveUsageBar.SetStatusMessage("Calculating your categorical Google Drive usage. Please wait.")

class GoSyncController(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, title="GoSync", size=(520,400), style=mainWindowStyle)

        try:
            self.sync_model = GoSyncModel()
        except ClientSecretsNotFound:
            dial = wx.MessageDialog(None, 'Client secret file was not found!\n\nDo you want to know how to create one?\n',
                                    'Error', wx.YES_NO | wx.ICON_EXCLAMATION)
            res = dial.ShowModal()

            if res == wx.ID_YES:
                webbrowser.open(CLIENT_SECRET_HELP_SITE, new=1, autoraise=True)

            sys.exit(1)
        except:
            dial = wx.MessageDialog(None, 'GoSync failed to initialize\n',
                                    'Error', wx.OK | wx.ICON_EXCLAMATION)
            res = dial.ShowModal()
            sys.exit(1)

        self.aboutdrive = self.sync_model.DriveInfo()

        title_string = "GoSync --%s (%s used of %s)" % (self.aboutdrive['name'],
                                                        self.FileSizeHumanize(long(self.aboutdrive['quotaBytesUsed'])),
                                                        self.FileSizeHumanize(long(self.aboutdrive['quotaBytesTotal'])))
        self.SetTitle(title_string)
        appIcon = wx.Icon(APP_ICON, wx.BITMAP_TYPE_PNG)
        self.SetIcon(appIcon)
        menuBar = wx.MenuBar()
        menu = wx.Menu()

        menu_txt = 'Pause/Resume Sync'

        self.CreateMenuItem(menu, menu_txt, self.OnToggleSync, icon=os.path.join(HERE, 'resources/sync-menu.png'), id=ID_SYNC_TOGGLE)

        menu.AppendSeparator()
        self.CreateMenuItem(menu, 'A&bout', self.OnAbout, os.path.join(HERE, 'resources/info.png'))
        self.CreateMenuItem(menu, 'E&xit', self.OnExit, os.path.join(HERE, 'resources/exit.png'))

        menuBar.Append(menu, '&File')

        self.SetMenuBar(menuBar)

        # Here we create a panel and a notebook on the panel
        p = wx.Panel(self, size=self.GetSize())
        nb = wx.Notebook(p)

        # create the page windows as children of the notebook
        accountPage = PageAccount(nb, self.sync_model)
        settingsPage = SettingsPage(nb, self.sync_model)

        # add the pages to the notebook with the label to show on the tab
        nb.AddPage(accountPage, "Account")
        nb.AddPage(settingsPage, "Settings")

        # finally, put the notebook in a sizer for the panel to manage
        # the layout
        sizer = wx.BoxSizer()
        sizer.Add(nb, 1, wx.EXPAND)
        p.SetSizer(sizer)

        self.sb = self.CreateStatusBar(2)
        self.sb.SetStatusWidths([-6, -1])

        if self.sync_model.IsSyncEnabled():
            self.sb.SetStatusText("Running", 1)
        else:
            self.sb.SetStatusText("Paused", 1)

        GoSyncEventController().BindEvent(self, GOSYNC_EVENT_SYNC_STARTED,
                                          self.OnSyncStarted)
        GoSyncEventController().BindEvent(self, GOSYNC_EVENT_SYNC_UPDATE,
                                          self.OnSyncUpdate)
        GoSyncEventController().BindEvent(self, GOSYNC_EVENT_SYNC_DONE,
                                          self.OnSyncDone)
        GoSyncEventController().BindEvent(self, GOSYNC_EVENT_SYNC_TIMER,
                                          self.OnSyncTimer)
        GoSyncEventController().BindEvent(self, GOSYNC_EVENT_SYNC_INV_FOLDER,
                                          self.OnSyncInvalidFolder)

        self.sync_model.SetTheBallRolling()

    def OnSyncInvalidFolder(self, event):
        dial = wx.MessageDialog(None, 'Some of the folders to be sync\'ed were not found on remote server.\nPlease check.\n',
                                'Error', wx.OK | wx.ICON_EXCLAMATION)
        res = dial.ShowModal()

    def OnSyncTimer(self, event):
        unicode_string = event.data.pop()
        self.sb.SetStatusText(unicode_string.encode('ascii', 'ignore'))

    def OnSyncStarted(self, event):
        self.sb.SetStatusText("Sync started...")

    def OnSyncUpdate(self, event):
        unicode_string = event.data.pop()
        self.sb.SetStatusText(unicode_string.encode('ascii', 'ignore'))

    def OnSyncDone(self, event):
        if not event.data:
            self.sb.SetStatusText("Sync completed.")
        else:
            self.sb.SetStatusText("Sync failed. Please check the logs.")

    def CreateMenuItem(self, menu, label, func, icon=None, id=None):
        if id:
            item = wx.MenuItem(menu, id, label)
        else:
            item = wx.MenuItem(menu, -1, label)

        if icon:
            item.SetBitmap(wx.Bitmap(icon))

        if id:
            self.Bind(wx.EVT_MENU, func, id=id)
        else:
            self.Bind(wx.EVT_MENU, func, id=item.GetId())

        menu.AppendItem(item)
        return item

    def FileSizeHumanize(self, size):
        size = abs(size)
        if (size==0):
            return "0B"
        units = ['B','KB','MB','GB','TB','PB','EB','ZB','YB']
        p = math.floor(math.log(size, 2)/10)
        return "%.3f%s" % (size/math.pow(1024,p),units[int(p)])

    def OnExit(self, event):
        dial = wx.MessageDialog(None, 'GoSync will stop syncing files until restarted.\nAre you sure to quit?\n',
                                'Question', wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
        res = dial.ShowModal()
        if res == wx.ID_YES:
            wx.CallAfter(self.Destroy)

    def OnToggleSync(self, evt):
        if self.sync_model.IsSyncEnabled():
            self.sync_model.StopSync()
            self.sb.SetStatusText("Paused", 1)
        else:
            self.sync_model.StartSync()
            self.sb.SetStatusText("Running", 1)

    def OnAbout(self, evt):
        """About GoSync"""
        about = wx.AboutDialogInfo()
        about.SetIcon(wx.Icon(ABOUT_ICON, wx.BITMAP_TYPE_PNG))
        about.SetName(APP_NAME)
        about.SetVersion(APP_VERSION)
        about.SetDescription(APP_DESCRIPTION)
        about.SetCopyright(APP_COPYRIGHT)
        about.SetWebSite(APP_WEBSITE)
        about.SetLicense(APP_LICENSE)
        about.AddDeveloper(APP_DEVELOPER)
        about.AddArtist(APP_DEVELOPER)
        wx.AboutBox(about)
arentoine commented 4 years ago

Hello,

it not yet compatible with Python 3, only python 2.7.

The code is ready and should be available soon.

We'll keep you posted as soon as it's released.

Regards

arentoine commented 4 years ago

Hello,

the code for Python 3 is now available.

Please follow the installation procedure at https://github.com/arentoine/gosync/wiki.

It would be appreciated if you could give us some feedback.

Regards

SGmuwa commented 4 years ago

@arentoine

Please follow the installation procedure at https://github.com/arentoine/gosync/wiki.

Paragraph «Retrieve the file "Crendentials.json" (Enable Google Drive API)» is repeated.

Edit filename "Crendentials.json" → "credentials.json"

SGmuwa commented 4 years ago

The problem has disappeared. I managed to install GoSync without sudo privileges: pip3 install --upgrade .. Now I'm learning how to work with GoSync. image image Now I clicked on the Refresh button and the program does not respond, the CPU is busy 1% by GoSync. I uninstalled the program and installed it using the sudo pip3 install --upgrade .. The program’s behavior has not changed. If I cannot solve the problem on my side, I will create a new issuse.

arentoine commented 4 years ago

Hello,

based on the screenshots, it doesn't look right to me. It should not take more than a fraction of a second for the calculation to complete with an empty drive. Is your drive empty ?

Can you look for an error in the log (~/GoSync.log) and send it to me?

Regards

Le mer. 6 mai 2020, à 17 h 13, SGmuwa notifications@github.com a écrit :

The problem has disappeared. I managed to install GoSync without sudo privileges: pip3 install --upgrade .. Now I'm learning how to work with him. [image: image] https://user-images.githubusercontent.com/6484464/81228429-bafb9c80-8ff6-11ea-8689-f72b66894c46.png [image: image] https://user-images.githubusercontent.com/6484464/81228447-bfc05080-8ff6-11ea-9c6b-0644c9c93b46.png Now I clicked on the Refresh button and the program does not respond, the CPU is busy 1% by GoSync. I uninstalled the program and installed it using the sudo pip3 install --upgrade .. The program’s behavior has not changed.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/hschauhan/gosync/issues/25#issuecomment-624894302, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOEGL3AVFD2WWYG3X2RWXATRQHHITANCNFSM4MY44P7Q .

SGmuwa commented 4 years ago

@arentoine see https://github.com/hschauhan/gosync/issues/27#issuecomment-626353618