applications_with_wxpython
applications_with_wxpython copied to clipboard
Chapter 11 - Text Search - Weird exception being thrown
Never finds the config.ini. Always claims grin3 not installed even though it is and the config.ini file exists. Repo code has the same issue as the book code.
Mac OS 10.14.4 32G RAM Python 3.7.3
Exception in thread Thread-1: Traceback (most recent call last): File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 917, in _bootstrap_inner self.run() File "/Volumes/ProjectDrive/git-projects/Creating_GUI_Applications_with_wxPython/src/Chapter_11/text_search/search_thread.py", line 29, in run output = subprocess.check_output(cmd, encoding='UTF-8') File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 395, in check_output **kwargs).stdout File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 472, in run with Popen(*popenargs, **kwargs) as process: File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 775, in init restore_signals, start_new_session) File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 1522, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) PermissionError: [Errno 13] Permission denied: '/Volumes/ProjectDrive/git-projects/Creating_GUI_Applications_with_wxPython/src/Chapter_11/text_search/config.ini'
-rw-r--r-- 1 chuck wheel 132B Apr 25 08:01 config.ini -rw-r--r-- 1 chuck wheel 7.2K Apr 25 07:54 main.py -rw-r--r-- 1 chuck wheel 2.6K Apr 25 07:44 preferences.py -rw-r--r-- 1 chuck wheel 1.2K Apr 25 07:53 search_thread.py
Hmmm. Works on Linux (Xubuntu 18.04) and Windows 7. I will have to try this on my Mac later
Works on my Macbook Pro 10.14.4, Python 3.6.4. I do see this in stdout:
objc[11673]: Class FIFinderSyncExtensionHost is implemented in both /System/Library/PrivateFrameworks/FinderKit.framework/FinderKit (0x12a2df3c8) and /System/Library/PrivateFrameworks/FileProvider.framework/OverrideBundles/FinderSyncCollaborationFileProviderOverride.bundle/Contents/MacOS/FinderSyncCollaborationFileProviderOverride (0x132108f50). One of the two will be used. Which one is undefined.
However, this error or warning does not seem to affect the running of the program at all.
Are you sure you are installing grin3 ?
Looks like my warning has something to do with Tkinter - https://github.com/jarvisteach/appJar/issues/285
I don't know why it shows up when running wxPython, but that thread mentions that PyQt5 is also causing that error to pop up, so maybe it just has something to do with GUI toolkits in general. Doesn't seem to affect anything though.
Pretty sure. I’m working in a virtual python environment and I’ve installed grin3 via: pip install grin3.
I’ll do some more investigation and see what I can turn up. :-/
On Apr 25, 2019, at 6:08 PM, Mike Driscoll [email protected] wrote:
Works on my Macbook Pro 10.14.4, Python 3.6.4. I do see this in stdout:
objc[11673]: Class FIFinderSyncExtensionHost is implemented in both /System/Library/PrivateFrameworks/FinderKit.framework/FinderKit (0x12a2df3c8) and /System/Library/PrivateFrameworks/FileProvider.framework/OverrideBundles/FinderSyncCollaborationFileProviderOverride.bundle/Contents/MacOS/FinderSyncCollaborationFileProviderOverride (0x132108f50). One of the two will be used. Which one is undefined.
However, this error or warning does not seem to affect the running of the program at all.
Are you sure you are installing grin3 ?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/driscollis/applications_with_wxpython/issues/26#issuecomment-486889555, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA62YJWOUGI7N5SDGKQ6FTPSJIX5ANCNFSM4HIOBLCQ.
Hmmm. I will have to try creating a virtualenv then when I get a chance. Not sure why that would happen in that scenario though
I created a virtualenv using Python's venv
module. I installed wxPython, PyPubSub and ObjectListView in it and the text search code worked fine for me.
This is quite strange. Figuring I had screwed something up, I did the following:
- Create new directory
- Change to the new directory
- Create Python 3 virtual environment (python3 -m venv .)
- Activate Python 3 (source bin/activate)
- Update pip (pip install pip —upgrade)
- Install wxPython (pip install wxPython)
-
Install ObjectListView (pip install ObjectListView)
- Install grin3 (pip install grin3)
- Install PyPubSub (pip install PyPubSub)
- Do a pull on the Git repo to ensure that the code is current
- Copy the chapter 11 folder to the new directory.
-
Run the program.
- Set the config.ini location in Preferences and save.
[Settings] grin = /Users/chuck/pytest/text_search/config.ini
- Select the current directory where the source code resides using the Browse button.
- Type pref in the search field then tap Enter
- Nothing appears in the ObjectListView and I get the following message in the terminal window:
objc[6019]: Class FIFinderSyncExtensionHost is implemented in both /System/Library/PrivateFrameworks/FinderKit.framework/Versions/A/FinderKit (0x7fff8d11b3c8) and /System/Library/PrivateFrameworks/FileProvider.framework/OverrideBundles/FinderSyncCollaborationFileProviderOverride.bundle/Contents/MacOS/FinderSyncCollaborationFileProviderOverride (0x115aa1f50). One of the two will be used. Which one is undefined. Exception in thread Thread-1: Traceback (most recent call last): File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 917, in _bootstrap_inner self.run() File "/Users/chuck/pytest/text_search/search_thread.py", line 29, in run output = subprocess.check_output(cmd, encoding='UTF-8') File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 395, in check_output **kwargs).stdout File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 472, in run with Popen(*popenargs, **kwargs) as process: File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 775, in init restore_signals, start_new_session) File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 1522, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) PermissionError: [Errno 13] Permission denied: '/Users/chuck/pytest/text_search/config.ini'
I installed Python 3 using Homebrew, so I have no idea why it’s seeing two different versions of Class FIFinderSyncExtensionHost. However, I’m not sure that it has anything to do with the permissions issue. :-/
Thoughts appreciated.
Best regards,
Chuck
On Apr 26, 2019, at 6:18 PM, Mike Driscoll [email protected] wrote:
I created a virtualenv using Python's venv module. I installed wxPython, PyPubSub and ObjectListView in it and the text search code worked fine for me.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/driscollis/applications_with_wxpython/issues/26#issuecomment-487242853, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA62YOYZHW6JNKE7KQJSH3PSOSYFANCNFSM4HIOBLCQ.
Hi Mike,
I have removed all versions of Python (other than the system installed 2.7), then reinstalled Python 3 using Homebrew. I’m now getting the following error message in the terminal:
Exception in thread Thread-2: Traceback (most recent call last): File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 917, in _bootstrap_inner self.run() File "/Users/chuck/pytest/text_search/search_thread.py", line 29, in run output = subprocess.check_output(cmd, encoding='UTF-8') File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 395, in check_output **kwargs).stdout File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 472, in run with Popen(*popenargs, **kwargs) as process: File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 775, in init restore_signals, start_new_session) File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 1522, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) OSError: [Errno 8] Exec format error: '/Users/chuck/pytest/text_search/config.ini’
Weirder and weirder...
On Apr 26, 2019, at 6:18 PM, Mike Driscoll [email protected] wrote:
I created a virtualenv using Python's venv module. I installed wxPython, PyPubSub and ObjectListView in it and the text search code worked fine for me.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/driscollis/applications_with_wxpython/issues/26#issuecomment-487242853, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA62YOYZHW6JNKE7KQJSH3PSOSYFANCNFSM4HIOBLCQ.
I hate to ask this, but could you try with Python 3.6? I wonder if there is some weird incompatibility with 3.7. I don't have 3.7 on my Mac at the moment to test with.
Windows 10 appears to work wit Python 3.7, although I am seeing this error in stdout:
Exception in thread Thread-2:
Traceback (most recent call last):
File "c:\Program Files (x86)\Python37-32\lib\threading.py", line 917, in _bootstrap_inner
self.run()
File "C:\Users\mike\Downloads\applications_with_wxpython-master\applications_with_wxpython-master\chapter11_search_utility\text_search\search_thread.py", line 38, in run
results[current_key].append(line)
KeyError: ''
I still get search results though.
I went ahead and fixed the issue I mentioned finding on Windows 10
FYI: I added Python 3.7 to my Mac and ran this code. I do get an error now that does not appear in 3.6. However, it is different from yours:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/bin/grin", line 10, in <module>
sys.exit(grin_main())
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/grin.py", line 1263, in grin_main
report = g.grep_a_file(filename, opener=openers[kind])
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/grin.py", line 568, in grep_a_file
unique_context = self.do_grep(f)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/grin.py", line 386, in do_grep
block = self.read_block_with_context(None, fp, fp_size)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/grin.py", line 339, in read_block_with_context
curr_block = (prev.data[prev.end:] + block_main + ('' if is_last_block else fp.readline()))
TypeError: can only concatenate str (not "bytes") to str
Exception in thread Thread-3:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/Users/michael/Dropbox/Books/Applications_with_wxPython/code/chapter11_search_utility/text_search/search_thread.py", line 29, in run
output = subprocess.check_output(cmd, encoding='UTF-8')
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 395, in check_output
**kwargs).stdout
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 487, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/Library/Frameworks/Python.framework/Versions/3.7/bin/grin', 'wx', '/Users/michael']' returned non-zero exit status 1.
This appears to be a grin bug, not one with my code. I do get some search results returned regardless of the error, although I don't know if I am getting all the results I should.
Just downloaded the code for this same project and am trying to run it under VSCode 1.74.0 on Win10. The problem I am running into is that selecting the grin.exe in the preferences dialog browser file selector never shows up in the preferences text control and hence I can never search for anything since the Save operation always fails with "Grin location not set!" FWIW, the grin location is: C:\Users\arnold\AppData\Local\Programs\Python\Python39\Scripts\grin.exe