-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port to Python3 [GCI] #31
Conversation
sgmllib was in Python 2, deprecated in Python 2.6, and removed in Python 3. Rather than add a dependency, the code should be ported to a library bundled with Python 3. Only one other Sugar activity is affected by this; Infoslicer. Your exec line has a typo. |
@quozl , I had thought of porting sgmllib, but however |
Thanks for the research. I hadn't twigged that feedparser.py is embedded source. Debian has a Python 3 package of Feedparser. I'm fine with using that. Debian does not have sgmllib as a package. However, Fedora does not have a package for Feedparser on Python 3. Some happy Fedora maintainer would have to make a package first. If you'd like to update the embedded Feedparser to Python 3, go ahead. You might look at the Debian package to see how they deal with the sgmllib no longer in Python 3. |
@quozl Fedora gives a feedparser for python3 too
|
Okay, thanks. Can you use that and keep it embedded? |
@quozl, like keep an internal copy also? |
Can you include feedparser in the activity, using the Python 3 version of feedparser you have found? |
@quozl should I include the source code of feedparser in the activity? |
Yes, that's what we have now, in the master branch, isn't it? |
No, we are having a python2 version of it. Feedparser is no longer a single file, it has turned into a heavy package folder |
Not yet ready to merge;
|
Until its confirmed that OPDS has officially supported 2.0, and as python2 is getting deprecated in a few days, EDIT: |
Thanks. We have to be more forward looking than current support statements. I know feedbooks.com do support OPDS 1.2. So #32 says "determine if feedbooks.com and archive.org can support the new protocol". We also have to be more forward looking than current deprecation statements. Although Python 2 deprecation has been announced and reinforced several times, we've often seen deprecations not take effect because there has been either (a) not enough people moving to the new version or API, or (b) enough people suddenly appear to provide ongoing support of the old version or API. So I'm not swayed by repeated mentions of deprecation. Python 2 is just a C program, after all. I'm fairly sure Red Hat will be supporting Python 2 for enterprise customers, as will Canonical. Consequently their release of source code may facilitate derivatives such as CentOS holding on to Python 2 for longer than the Python Foundation expects or cares about. But thanks for adding sgmllib. That will get us moving on this pull request. |
Thanks. Tested;
Hope that helps! |
I've checked as of 03e4b94 here and I agree no results are shown. I've checked master, and it does show results. I understand you don't have a Python 2 environment working? Can we help with that? Or, please add logging if you need me to test what happens. Or give instructions for me to use Pdb. |
This comment has been minimized.
This comment has been minimized.
This is probably what happens on arch linux whch has completely changed all their build headers from python2 to Python3 . And this missing Python2 headers are also a fact of wikipedia-activity which compiled on a Ubuntu WSL Subsystem today, but not on my Arch ❓ Running sugar-activity instead of sugar-activity3 gives
This is a faulty packages of 0.114 sugar-toolkit-gtk3 (based on python2 patched to work on arch) is causing conflicts with my AUR (sugar3-toolkit-gtk3) (python3) |
@srevinsaju, the arch install failure is because you have already installed Sugar by hand or using your own packages. The install of sugar-toolkit failed but you don't need sugar-toolkit, as that is the GTK 2 Python 2 toolkit. GetBooks is currently GTK 3 Python 2. Install the sugar-toolkit-gtk3 repository source instead, or change your packaging of sugar-toolkit-gtk3 to include Python 2 in the build steps. https://github.com/sugarlabs/sugar/blob/master/docs/development-environment.md#native-sugar shows how to build by hand. Or, if you don't want to disrupt your working system, use a VM of Sugar Live Build, which includes Python 2 support. |
This comment has been minimized.
This comment has been minimized.
"make install" looked successful. Where was the sugar3 module installed? Import it from there? See the native install instructions for how sometimes the system path doesn't include what is used by the default install. |
Oh, I totally forgot about it. Let me check it out :) Thanks @quozl |
@quozl I need assistance, python2.7 doesn't exist o_O.
|
I've no idea about flakpak, sorry. I don't know what that output means. You do need a version of Python 2 installed and working in order to install the Sugar Toolkit for GTK 3. |
Ohh! Thanks for pointing out my mistake. |
@quozl, @Aniketh21Mathur, the cursor is just spinning but the activity works, just try clicking 'By Title or any other component in the tree view after the internet archive option. I think the cursor spin was not reset. I will try to fix it today |
@quozl @Aniket21mathur I have fixed the errors. they were actually not errors, but rather the wait cursor was not reset to the original cursor once we press the Internet archive option. I was able to recreate the error by @Aniket21mathur which gave a TypeError, which I fixed it on cec13b9 and the logging was updated on 253cb14. The bozo_exception should not pass simply if it ever happens in future |
Thanks. I've tested 253cb14. I switched to Internet Archive, then typed pride and prejudice into the search, and pressed enter. The cursor began to spin. The message Performing lookup, please wait... did appear. I waited ten seconds. Nothing else happened. No logs. I repeated the test with network packet tracing on my firewall system;
Connection was opened by the app at 13:12:04.944038 and at 13:12:05.148803 a request sent to www.archive.org over HTTP, a GET of the URI
Response was sent by the server at 13:12:05.707975 of content-type text/csv. Connection was closed by the server normally at 13:12:06.676381 along with the last data segment, total data size of 144180 bytes. The data seemed okay, but was not displayed. Connection was closed by the client in response at 13:12:06.916956 All up no more than three seconds for query and data transfer. Hope that helps! |
Internet Archive Query Class used return in the for loop. However, this does not allow the calling of update_cb which occurs after the for loop is over. The logic had to be altered to use break instead of return, so that the last update callback is called"
Yes @quozl your debugging helped me solve that issue too. I found out the Url was valid, and so was the csv file. However, due to a bad logic in the forloop, the QueryResults returned None instead of the updated_cb. Later update signal was not connected in the other GetIABooksActivity.py, so that was also fixed. Thanks for the help |
Thanks. Tetsed 0ea5a0c. Does display search results. Some of the search results can be downloaded. Some cannot. An error about the URL was displayed in an Alert. Logs contained "1579890286.778513 ERROR root: internet archive file list omits content type" Any idea why some cannot be downloaded? Is it something the activity can adapt to? |
@quozl I will check where the the LOG is emitted, |
Yes, the log is created in line 408, opds.py, which has a fixme I guess the internet archive didn't have the URL you were searching for, but its just an assumption. Did you try copy pasting the URL which it attempts to download, and heck manually, or you can send me which book you were trying to download, so I can debug it. Thanks |
@quozl Requesting review |
Nothing has changed? 0ea5a0c review comments above; some of the search results cannot be downloaded. The activity needs to do better at handling this before I would release it. |
@quozl if it important to notify the user, I would have to change the code at least 25% to include parent caller. This function was not working since before, but I shall workaround the issue then. Thanks |
It certainly is important. Software should always advise the user when it cannot perform a requested operation. The advice might not need to be detailed.
As I said above, my test was to type "pride and prejudice" into the search box and then try downloading from the various result lines. |
@quozl I have attempted a fix here, tried searching |
Thanks. Tested f46f676.
It doesn't seem to start. There's a flicker of the list, that's about it. Repeatable failure; the second result doesn't download, and no explanation. Some errors in log too; but not always happening;
|
@quozl I wasn't able to reproduce your error, what I see is this |
f46f676
to
37b7225
Compare
Ok, with 37b7225, I was able to reproduce the error, but I failed to find a fix to this issue. 😢 |
Thanks. I suggest adding more debug messages to help us find the problem. It may be in the Sugar Toolkit. When I try GetBooks v19 (Python 2) on Sugar 0.112 (Python 2), notable differences are;
You might also have a filtered internet connection. That's where debug messaging or tcpdump will help. |
@quozl I may not be able to fix it with the current knowledge I have on G** modules, but I may give some information that I found from debugging, that may help other contributors in future:
Possible Fixes:
You may close this PR if you prefer, well, I guess I am stuck with this now. |
Thanks. I'll keep it open, to inform the next person who tries to port. It may eventually be me doing it. The class The activities that use it are GetBooks, Read, ReadETexts, ShowNTell, and ViewSlides. Sugar itself has jarabe.util.Downloader. None of these have been as extensively tested on Python 3 as GetBooks has been in this pull request. That's the basis of suspicion. I've not debugged it yet. |
Ok thanks @quozl for the review. |
No longer current. |
No description provided.