Python 3.7 Filechooser crash
Versions
- Python3.7
- OS:Windows 10
- Kivy:1.10.1
- Kivy installation method:PIP
Description
After the file selector popup happens the program crashes. The same code has no issue on python 3.6.
Code and Logs
[INFO ] [Logger ] Record log in C:\Users\DWL\.kivy\logs\kivy_18-07-24_16.txt
[INFO ] [Kivy ] v1.10.1
[INFO ] [Python ] v3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)]
[INFO ] [Factory ] 194 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
[INFO ] [Text ] Provider: sdl2
[INFO ] [Window ] Provider: sdl2
[INFO ] [GL ] Using the "OpenGL" graphics system
[INFO ] [GL ] GLEW initialization succeeded
[INFO ] [GL ] Backend used <glew>
[INFO ] [GL ] OpenGL version <b'4.6.0 NVIDIA 388.43'>
[INFO ] [GL ] OpenGL vendor <b'NVIDIA Corporation'>
[INFO ] [GL ] OpenGL renderer <b'GeForce GTX 980 Ti/PCIe/SSE2'>
[INFO ] [GL ] OpenGL parsed version: 4, 6
[INFO ] [GL ] Shading version <b'4.60 NVIDIA'>
[INFO ] [GL ] Texture max size <16384>
[INFO ] [GL ] Texture max units <32>
[INFO ] [Window ] auto add sdl2 input provider
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
[INFO ] [VideoGstplayer] Using Gstreamer 1.14.1.0
[INFO ] [Video ] Provider: gstplayer
[INFO ] [Base ] Start application main loop
[INFO ] [GL ] NPOT texture support is available
The code used was lifted directly from your guide for filechooser.
If I change to python 3.6 the same code works.
Finally, after some Google-ing, I found someone with same issue. For me, same crash happening on Windows Server 2012 OS. And, yes, same code is working fine with Python 3.6
I am unclear. Is this issue being looked at or are we supposed to use 3.6?
Apparently nobody found the time/incentive to look into it yet, you can get a more detailed log by running
python main.py -c kivy:log_level:trace
and post it.
I just tested on python3.7 on linux, and i don't get the issue, so it's probably platform-specific.
Sorry, have been meaning to respond to this. The problem is very likely with win32file that is installed by pypiwin32. That is the only thing we import in filechooser selectively on windows that could be responsible https://github.com/kivy/kivy/blob/master/kivy/uix/filechooser.py#L120.
There are two distributions that provide the required modules I think, https://pypi.org/project/pywin32/ and https://pypi.org/project/pypiwin32/. Please take a look with pip freeze to see what you have installed. Try uninstalling and switching to the other to see if that fixes it and report back here with the results. You could also completely uninstalling both, but I'm not sure what else you have installed that may need it.
For reference, on py35 I have pypiwin32==219.
Here is a screenshot of what I have, both and both up to date.
On Wednesday, September 26, 2018, 5:40:16 PM PDT, matham <[email protected]> wrote:
Sorry, have been meaning to respond to this. The problem is very likely with win32file that is installed by pypiwin32. That is the only thing we import in filechooser selectively on windows that could be responsible https://github.com/kivy/kivy/blob/master/kivy/uix/filechooser.py#L120.
There are two distributions that provide the required modules I think, https://pypi.org/project/pywin32/ and https://pypi.org/project/pypiwin32/. Please take a look with pip freeze to see what you have installed. Try uninstalling and switching to the other to see if that fixes it and report back here with the results. You could also completely uninstalling both, but I'm not sure what else you have installed that may need it.
For reference, on py35 I have pypiwin32==219.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
Here is the log info:
C:\Users\DWL\Documents\Python_Projects\Kivy\Test\BlackBook-GUI-Kivy>python bbgui.py -c kivy:log_level:trace[INFO ] [Logger ] Record log in C:\Users\DWL\.kivy\logs\kivy_18-09-26_2.txt[INFO ] [Kivy ] v1.10.1[INFO ] [Python ] v3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)][INFO ] [Factory ] 194 symbols loaded[DEBUG ] [Cache ] register <kv.lang> with limit=None, timeout=None[TRACE ] [Lang ] load file C:\Program Files (x86)\Python37-32\lib\site-packages\kivy\data\style.kv[TRACE ] [Parser ] parsing 1291 lines[TRACE ] [Parser ] got directive <kivy 1.0>[TRACE ] [Builder ] build rule for <Label>[TRACE ] [Builder ] build rule for <-Button,-ToggleButton>[TRACE ] [Builder ] build rule for <BubbleContent>[TRACE ] [Builder ] build rule for <BubbleButton>[TRACE ] [Builder ] build rule for <Slider>[TRACE ] [Builder ] build rule for <ProgressBar>[TRACE ] [Builder ] build rule for <SplitterStrip>[TRACE ] [Builder ] build rule for <Scatter>[TRACE ] [Builder ] build rule for <RelativeLayout>[TRACE ] [Builder ] build rule for <Image,AsyncImage>[TRACE ] [Builder ] build rule for <EffectWidget>[TRACE ] [Builder ] build rule for <TabbedPanelContent>[TRACE ] [Builder ] build rule for <TabbedPanelStrip>[TRACE ] [Builder ] build rule for <StripLayout>[TRACE ] [Builder ] build rule for <TabbedPanelHeader>[TRACE ] [Builder ] build rule for <Selector>[TRACE ] [Builder ] build rule for <TextInput>[TRACE ] [Builder ] build rule for <TextInputCutCopyPaste>[TRACE ] [Builder ] build rule for <CodeInput>[TRACE ] [Builder ] build rule for <TreeViewNode>[TRACE ] [Builder ] build rule for <TreeViewLabel>[TRACE ] [Builder ] build rule for <StencilView>[TRACE ] [Builder ] build rule for <FileChooserListLayout>[TRACE ] [Builder ] build rule for <FileChooserListView>[TRACE ] [Builder ] build template for [FileListEntry@FloatLayout+TreeViewNode][TRACE ] [Builder ] build rule for <FileChooserIconLayout>[TRACE ] [Builder ] build rule for <FileChooserIconView>[TRACE ] [Builder ] build template for [FileIconEntry@Widget][TRACE ] [Builder ] build rule for <FileChooserProgress>[TRACE ] [Builder ] build rule for <Switch>[TRACE ] [Builder ] build rule for <ModalView>[TRACE ] [Builder ] build rule for <Popup>[TRACE ] [Builder ] build rule for <SpinnerOption>[TRACE ] [Builder ] build rule for <Spinner>[TRACE ] [Builder ] build rule for <ActionBar>[TRACE ] [Builder ] build rule for <ActionView>[TRACE ] [Builder ] build rule for <ActionSeparator>[TRACE ] [Builder ] build rule for <ActionButton,ActionToggleButton>[TRACE ] [Builder ] build rule for <ActionLabel>[TRACE ] [Builder ] build rule for <ActionGroup>[TRACE ] [Builder ] build rule for <ActionCheck>[TRACE ] [Builder ] build rule for <ActionPreviousImage@Image>[TRACE ] [Builder ] build rule for <ActionPreviousButton@Button>[TRACE ] [Builder ] build rule for <ActionPrevious>[TRACE ] [Builder ] build rule for <ActionGroup>[TRACE ] [Builder ] build rule for <ActionOverflow>[TRACE ] [Builder ] build rule for <ActionDropDown>[TRACE ] [Builder ] build template for [AccordionItemTitle@Label][TRACE ] [Builder ] build rule for <AccordionItem>[TRACE ] [Builder ] build rule for <SettingSpacer>[TRACE ] [Builder ] build rule for <SettingItem>[TRACE ] [Builder ] build rule for <SettingBoolean>[TRACE ] [Builder ] build rule for <SettingString>[TRACE ] [Builder ] build rule for <SettingPath>[TRACE ] [Builder ] build rule for <SettingOptions>[TRACE ] [Builder ] build rule for <SettingTitle>[TRACE ] [Builder ] build rule for <SettingSidebarLabel>[TRACE ] [Builder ] build rule for <SettingsPanel>[TRACE ] [Builder ] build rule for <Settings>[TRACE ] [Builder ] build rule for <InterfaceWithSidebar>[TRACE ] [Builder ] build rule for <InterfaceWithSpinner>[TRACE ] [Builder ] build rule for <MenuSpinner>[TRACE ] [Builder ] build rule for <MenuSidebar>[TRACE ] [Builder ] build rule for <ContentPanel>[TRACE ] [Builder ] build rule for <InterfaceWithTabbedPanel>[TRACE ] [Builder ] build rule for <ScrollView>[TRACE ] [Builder ] build rule for <VideoPlayerPreview>[TRACE ] [Builder ] build rule for <VideoPlayerAnnotation>[TRACE ] [Builder ] build rule for <VideoPlayer>[TRACE ] [Builder ] build rule for <CheckBox>[TRACE ] [Builder ] build rule for <ScreenManager>[TRACE ] [Builder ] build rule for <ColorPicker_Input@TextInput>[TRACE ] [Builder ] build rule for <ColorPicker_Label@Label>[TRACE ] [Builder ] build rule for <ColorPicker_Selector@BoxLayout>[TRACE ] [Builder ] build rule for <ColorWheel>[TRACE ] [Builder ] build rule for <ColorPicker>[DEBUG ] [Cache ] register <kv.image> with limit=None, timeout=60[DEBUG ] [Cache ] register <kv.atlas> with limit=None, timeout=None[TRACE ] [Image ] Unable to use <gif> as loader![TRACE ]Traceback (most recent call last): File "C:\Program Files (x86)\Python37-32\lib\site-packages\kivy\core\image\img_pil.py", line 8, in <module> import Image as PILImageModuleNotFoundError: No module named 'Image'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Program Files (x86)\Python37-32\lib\site-packages\kivy\core\__init__.py", line 129, in core_register_libs level=0) File "C:\Program Files (x86)\Python37-32\lib\site-packages\kivy\core\image\img_pil.py", line 11, in <module> from PIL import Image as PILImageModuleNotFoundError: No module named 'PIL'[TRACE ] [Image ] Unable to use <gif> as loader![TRACE ]Traceback (most recent call last): File "C:\Program Files (x86)\Python37-32\lib\site-packages\kivy\core\__init__.py", line 129, in core_register_libs level=0) File "C:\Program Files (x86)\Python37-32\lib\site-packages\kivy\core\image\img_ffpyplayer.py", line 7, in <module> import ffpyplayerModuleNotFoundError: No module named 'ffpyplayer'[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)[DEBUG ] [Cache ] register <kv.texture> with limit=1000, timeout=60[DEBUG ] [Cache ] register <kv.shader> with limit=1000, timeout=3600[TRACE ] [Parser ] parsing 19 lines[TRACE ] [Builder ] build rule for <-CoverBehavior>[INFO ] [Window ] Provider: sdl2[INFO ] [GL ] Using the "OpenGL" graphics system[INFO ] [GL ] GLEW initialization succeeded[DEBUG ] [GL ] available extensions:
Did you forget to include a screenshot? You said Here is a screenshot of what I have, both and both up to date.
The log doesn't help because these crashes don't get logged and it's a very long log so I'm snipping it.
No I didn't forget the screenshot it is a png attached to the e-mail.. I'll attach again.
On Wednesday, September 26, 2018, 7:24:23 PM PDT, matham <[email protected]> wrote:
Did you forget to include a screenshot? The log doesn't help much because these crashes don't get logged.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
Check the issue https://github.com/kivy/kivy/issues/5873 - the image is not shown.
You seem to have both installed. Can you please experiment by uninstalling one or both to see which causes the issue?
Kivy doesn't list this in its dependencies I think so I'm not sure who is responsible for pulling it in. So at best we can just tell people to uninstall the problem one.
On Thu, Sep 27, 2018, 12:07 AM Dan [email protected] wrote:
[image: pip_freeze] https://user-images.githubusercontent.com/26237736/46122898-361c9000-c1d0-11e8-951e-2703fe9f1a70.PNG
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kivy/kivy/issues/5873#issuecomment-424952057, or mute the thread https://github.com/notifications/unsubscribe-auth/ABkW_u6-dfZ77kc_-7H97XgAm4bj19scks5ufE8agaJpZM4VcUYr .
I'm using the kivy demo to test this.
Uninstalling pypiwin32 does not fix the problem Uninstalling just pywin32 gets you Errors about win32 module missing but the FileChooser loads directory but you are missing win32 functions.
pywin32 is a dependency of pypiwin32 so both are needed for full functionality.
Uninstalling both and not having either works, but you can no longer have win32 functions.
@bmmcwhirt Are you perchance using 32 bit python? I can't seem to reproduce the issue on 3.7 64 bit. Also, I tested with pypiwin32==223, pywin32==224. Which versions did you test with?
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have the means to take action. Please reach out if you have or find the answers we need so that we can investigate further.
@matham Have been getting this issue since June! You're right I am using 32-bit python! I'll try using 64-bit python
I also have this issue (Python 3.7.2, Kivy 1.11.0.dev):
Is the solution to downgrade to python 3.6?
Here are the versions I have installed:
certifi 2018.11.29 chardet 3.0.4 Cython 0.29.3 Django 2.1.5 docutils 0.14 ffpyplayer 4.1.0 idna 2.8 image 1.5.27 Kivy 1.11.0.dev0 Kivy-examples 1.11.0.dev0 Kivy-Garden 0.1.4 kivy.deps.glew 0.1.10 kivy.deps.gstreamer 0.1.13 kivy.deps.sdl2 0.1.18 numpy 1.16.0 pandas 0.23.4 Pillow 5.4.1 pip 19.0.1 Pygments 2.3.1 pypiwin32 223 pyserial 3.4 python-dateutil 2.7.5 pytz 2018.9 pywin32 224 requests 2.21.0 setuptools 40.6.3 six 1.12.0 urllib3 1.24.1 wheel 0.32.3
I believe switching to 64 bit allowed me to get passed this.
On Wed, Jan 23, 2019 at 7:09 AM, Dehole[email protected] wrote:
I also have this issue (Python 3.7.2, Kivy 1.11.0.dev):
Is the solution to downgrade to python 3.6?
Here are the versions I have installed:
certifi 2018.11.29 chardet 3.0.4 Cython 0.29.3 Django 2.1.5 docutils 0.14 ffpyplayer 4.1.0 idna 2.8 image 1.5.27 Kivy 1.11.0.dev0 Kivy-examples 1.11.0.dev0 Kivy-Garden 0.1.4 kivy.deps.glew 0.1.10 kivy.deps.gstreamer 0.1.13 kivy.deps.sdl2 0.1.18 numpy 1.16.0 pandas 0.23.4 Pillow 5.4.1 pip 19.0.1 Pygments 2.3.1 pypiwin32 223 pyserial 3.4 python-dateutil 2.7.5 pytz 2018.9 pywin32 224 requests 2.21.0 setuptools 40.6.3 six 1.12.0 urllib3 1.24.1 wheel 0.32.3
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
That's strange since I am running 64 bit of python. I have tried running the kivy examples in python 3.7.0 as well, with the same issues.
I can upload whatever is needed to help troubleshoot this issue.
Since switching to 64 bit seemd to have resolved my issue it has been awhile, but I'll test more tonight to verify my claim.
On Wed, Jan 23, 2019 at 8:13 AM, Dehole[email protected] wrote:
That's strange since I am running 64 bit of python. I have tried running the kivy examples in python 3.7.0 as well, with the same issues.
I can upload whatever is needed to help troubleshoot this issue.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
Using 3.7.2 64 bit I no longer have an issue. On Wednesday, January 23, 2019, 8:13:02 AM PST, Dehole [email protected] wrote:
That's strange since I am running 64 bit of python. I have tried running the kivy examples in python 3.7.0 as well, with the same issues.
I can upload whatever is needed to help troubleshoot this issue.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
I was able to reproduce it and it seems that it is related to pygame being the Provider for the crashing version.
When running RST_Editor from kivy-examples (and clicking Load):
[ERROR ] unable to access to <\pagefile.sys> Traceback (most recent call last): File "D:\Customers\Dustin\KivyPy3\.venv\lib\site-packages\kivy\uix\filechooser.py", line 178, in is_hidden return GetFileAttributesExW(fn)[0] & FILE_ATTRIBUTE_HIDDEN pywintypes.error: (32, 'GetFileAttributesEx', 'The process cannot access the file because it is being used by another process.')
For the crashing version (using pygame):
`Fatal Python error: (pygame parachute) Segmentation Fault
Current thread 0x00003e44 (most recent call first):
File "C:\Python37\lib\site-packages\kivy\uix\filechooser.py", line 178 in is_hidden
File "C:\Python37\lib\site-packages\kivy\uix\filechooser.py", line 860 in
The list of packages installed on the crashing version: `Package Version
altgraph 0.16.1 asn1crypto 0.24.0 astroid 2.0.1 backcall 0.1.0 bcrypt 3.1.4 bleach 3.0.2 casttube 0.2.0 certifi 2018.4.16 cffi 1.11.5 chardet 3.0.4 colorama 0.3.9 crcmod 1.7 cryptography 2.3.1 cycler 0.10.0 Cython 0.28.5 ddbase 0.0.2 DDII 0.0.14 decorator 4.3.0 defusedxml 0.5.0 docutils 0.14 entrypoints 0.3 fabric 2.4.0 flake8 3.5.0 ftd2xx-py3k 1.0 future 0.16.0 idna 2.7 ifaddr 0.1.4 intelhex 2.2.1 invoke 1.2.0 ipaddress 1.0.22 ipykernel 5.1.0 ipython 7.0.1 ipython-genutils 0.2.0 ipywidgets 7.4.2 isort 4.3.4 jedi 0.13.1 Jinja2 2.10 json-rpc 1.11.0 jsonschema 2.6.0 jupyter 1.0.0 jupyter-client 5.2.3 jupyter-console 6.0.0 jupyter-core 4.4.0 Kivy 1.11.0.dev0 Kivy-examples 1.10.1 Kivy-Garden 0.1.4 kivy.deps.angle 0.1.7 kivy.deps.glew 0.1.10 kivy.deps.glew-dev 0.1.10 kivy.deps.gstreamer 0.1.13 kivy.deps.gstreamer-dev 0.1.13 kivy.deps.sdl2 0.1.18 kivy.deps.sdl2-dev 0.1.18 kiwisolver 1.0.1 lazy-object-proxy 1.3.1 macholib 1.11 MarkupSafe 1.1.0 matplotlib 3.0.0 mccabe 0.6.1 MinimalModbus 0.7 mistune 0.8.4 mooshimeter 0.1.0 nbconvert 5.4.0 nbformat 4.4.0 notebook 5.7.4 numpy 1.15.3 pandas 0.23.4 pandocfilters 1.4.2 paramiko 2.4.2 parso 0.3.1 pefile 2018.8.8 pickleshare 0.7.5 pip 19.0 pipenv 2018.11.26 prometheus-client 0.5.0 prompt-toolkit 2.0.6 protobuf 3.6.1 pyasn1 0.4.4 PyChromecast 2.3.0 pycodestyle 2.3.1 pycparser 2.19 pyflakes 1.6.0 pygame 1.9.4 Pygments 2.2.0 PyInstaller 3.4 pylint 2.0.1 PyMeasure 0.5.3 PyNaCl 1.3.0 pyparsing 2.2.2 pypiwin32 223 Pypubsub 4.0.0 pyqtgraph 0.10.0 pyserial 3.4 python-dateutil 2.7.3 pytz 2018.7 PyVISA 1.9.1 pywin32 223 pywin32-ctypes 0.2.0 pywinpty 0.5.5 pyzmq 17.1.2 qtconsole 4.4.3 requests 2.19.1 scipy 1.2.0 seaborn 0.9.0 Send2Trash 1.5.0 setuptools 40.6.3 simplegeneric 0.8.1 six 1.11.0 terminado 0.8.1 testpath 0.4.2 tornado 5.1.1 traitlets 4.3.2 urllib3 1.23 vboxapi 1.0 virtualenv 16.0.0 virtualenv-clone 0.5.1 virtualenvwrapper-win 1.2.5 wcwidth 0.1.7 webencodings 0.5.1 Werkzeug 0.14.1 wheel 0.32.3 widgetsnbextension 3.4.2 wrapt 1.10.11 wxPython 4.0.3 youtube-dl 2018.10.5 zeroconf 0.21.3`
I fixed it by adding hiddenimports=['win32timezone'] to my .spec file. hope it helps!
This question's answer seems to address the problem with .sys files in windows, by creating a filter: https://stackoverflow.com/questions/42393319/kivy-filechooser-doubleclick. Check the section: # filter added. Since windows will throw error on sys files self.fclv = MyFileChooser(filters= [lambda folder, filename: not filename.endswith('.sys')])
Running an edited version of example from the docs, see code below, the code does not crash and operates as expected. Python 3.11.4 Kivy 2.2.1 Windows 11
There are a set of log messages related to accessing hidden system files, these are also listed below. @Julian-O I recommend closing this issue.
ERROR ] unable to access to <\DumpStack.log.tmp>
Traceback (most recent call last):
File "C:\Users\ellio\PycharmProjects\KivyHelp222\venv\Lib\site-packages\kivy\uix\filechooser.py", line 180, in is_hidden
return GetFileAttributesExW(fn)[0] & FILE_ATTRIBUTE_HIDDEN
^^^^^^^^^^^^^^^^^^^^^^^^
pywintypes.error: (32, 'GetFileAttributesEx', 'The process cannot access the file because it is being used by another process.')
[ERROR ] unable to access to <\hiberfil.sys>
Traceback (most recent call last):
File "C:\Users\ellio\PycharmProjects\KivyHelp222\venv\Lib\site-packages\kivy\uix\filechooser.py", line 180, in is_hidden
return GetFileAttributesExW(fn)[0] & FILE_ATTRIBUTE_HIDDEN
^^^^^^^^^^^^^^^^^^^^^^^^
pywintypes.error: (32, 'GetFileAttributesEx', 'The process cannot access the file because it is being used by another process.')
[ERROR ] unable to access to <\pagefile.sys>
Traceback (most recent call last):
File "C:\Users\ellio\PycharmProjects\KivyHelp222\venv\Lib\site-packages\kivy\uix\filechooser.py", line 180, in is_hidden
return GetFileAttributesExW(fn)[0] & FILE_ATTRIBUTE_HIDDEN
^^^^^^^^^^^^^^^^^^^^^^^^
pywintypes.error: (32, 'GetFileAttributesEx', 'The process cannot access the file because it is being used by another process.')
[ERROR ] unable to access to <\swapfile.sys>
Traceback (most recent call last):
File "C:\Users\ellio\PycharmProjects\KivyHelp222\venv\Lib\site-packages\kivy\uix\filechooser.py", line 180, in is_hidden
return GetFileAttributesExW(fn)[0] & FILE_ATTRIBUTE_HIDDEN
^^^^^^^^^^^^^^^^^^^^^^^^
pywintypes.error: (32, 'GetFileAttributesEx', 'The process cannot access the file because it is being used by another process.')
[ERROR ] [unable to access to <C]\DumpStack.log.tmp>
Traceback (most recent call last):
File "C:\Users\ellio\PycharmProjects\KivyHelp222\venv\Lib\site-packages\kivy\uix\filechooser.py", line 180, in is_hidden
return GetFileAttributesExW(fn)[0] & FILE_ATTRIBUTE_HIDDEN
^^^^^^^^^^^^^^^^^^^^^^^^
pywintypes.error: (32, 'GetFileAttributesEx', 'The process cannot access the file because it is being used by another process.')
[ERROR ] [unable to access to <C]\hiberfil.sys>
Traceback (most recent call last):
File "C:\Users\ellio\PycharmProjects\KivyHelp222\venv\Lib\site-packages\kivy\uix\filechooser.py", line 180, in is_hidden
return GetFileAttributesExW(fn)[0] & FILE_ATTRIBUTE_HIDDEN
^^^^^^^^^^^^^^^^^^^^^^^^
pywintypes.error: (32, 'GetFileAttributesEx', 'The process cannot access the file because it is being used by another process.')
[ERROR ] [unable to access to <C]\pagefile.sys>
Traceback (most recent call last):
File "C:\Users\ellio\PycharmProjects\KivyHelp222\venv\Lib\site-packages\kivy\uix\filechooser.py", line 180, in is_hidden
return GetFileAttributesExW(fn)[0] & FILE_ATTRIBUTE_HIDDEN
^^^^^^^^^^^^^^^^^^^^^^^^
pywintypes.error: (32, 'GetFileAttributesEx', 'The process cannot access the file because it is being used by another process.')
[ERROR ] [unable to access to <C]\swapfile.sys>
Traceback (most recent call last):
File "C:\Users\ellio\PycharmProjects\KivyHelp222\venv\Lib\site-packages\kivy\uix\filechooser.py", line 180, in is_hidden
return GetFileAttributesExW(fn)[0] & FILE_ATTRIBUTE_HIDDEN
^^^^^^^^^^^^^^^^^^^^^^^^
pywintypes.error: (32, 'GetFileAttributesEx', 'The process cannot access the file because it is being used by another process.')
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.floatlayout import FloatLayout
from kivy.properties import ObjectProperty
from kivy.uix.popup import Popup
import os
kv = """
Root:
text_input: text_input
BoxLayout:
orientation: 'vertical'
BoxLayout:
size_hint_y: None
height: 30
Button:
text: 'Load'
on_release: root.show_load()
Button:
text: 'Save'
on_release: root.show_save()
BoxLayout:
TextInput:
id: text_input
text: ''
RstDocument:
text: text_input.text
show_errors: True
<LoadDialog>:
BoxLayout:
size: root.size
pos: root.pos
orientation: "vertical"
FileChooserListView:
id: filechooser
BoxLayout:
size_hint_y: None
height: 30
Button:
text: "Cancel"
on_release: root.cancel()
Button:
text: "Load"
on_release: root.load(filechooser.path, filechooser.selection)
<SaveDialog>:
text_input: text_input
BoxLayout:
size: root.size
pos: root.pos
orientation: "vertical"
FileChooserListView:
id: filechooser
on_selection: text_input.text = self.selection and self.selection[0] or ''
TextInput:
id: text_input
size_hint_y: None
height: 30
multiline: False
BoxLayout:
size_hint_y: None
height: 30
Button:
text: "Cancel"
on_release: root.cancel()
Button:
text: "Save"
on_release: root.save(filechooser.path, text_input.text)
"""
class LoadDialog(FloatLayout):
load = ObjectProperty(None)
cancel = ObjectProperty(None)
class SaveDialog(FloatLayout):
save = ObjectProperty(None)
text_input = ObjectProperty(None)
cancel = ObjectProperty(None)
class Root(FloatLayout):
loadfile = ObjectProperty(None)
savefile = ObjectProperty(None)
text_input = ObjectProperty(None)
def dismiss_popup(self):
self._popup.dismiss()
def show_load(self):
content = LoadDialog(load=self.load, cancel=self.dismiss_popup)
self._popup = Popup(title="Load file", content=content,
size_hint=(0.9, 0.9))
self._popup.open()
def show_save(self):
content = SaveDialog(save=self.save, cancel=self.dismiss_popup)
self._popup = Popup(title="Save file", content=content,
size_hint=(0.9, 0.9))
self._popup.open()
def load(self, path, filename):
with open(os.path.join(path, filename[0])) as stream:
self.text_input.text = stream.read()
self.dismiss_popup()
def save(self, path, filename):
with open(os.path.join(path, filename), 'w') as stream:
stream.write(self.text_input.text)
self.dismiss_popup()
class EditorApp(App):
def build(self):
return Builder.load_string(kv)
if __name__ == '__main__':
EditorApp().run()
@ElliotGarbus: I would like to close this, but I am unsure.
- We are still getting error log messages on what should be a mundane task.
- The reports were very config-dependent, so showing it works on one config isn't sufficient to saw it is closed.
- Some of the proposed causes seem unlikely given the evidence. Some of the proposed work-arounds seem very fragile (timezones? .sys files only?)
@dehole @imalinkowskip @joyZombie @Dannylew12 Are any of you still encountering this with Kivy 2.2.1, and recent versions of the dependencies?
@Julian-O The error messages in the log will only occur if the path in the FileChooser is set to the root (C:) directory in Windows. Set it to any other directory these messages will not be seen. I view this as a non-issue. The workarounds are not required - the system is not crashing.
I'm fine waiting to see if others are still experiencing an issue.
Edit: It might be reasonable to consider if the log messages should be changed to warning (or even info) from error.
@ElliotGarbus: I am taking a different position:
FileChooser needs to work out whether a file is hidden. On Windows it calls win32file.GetFileAttributesExW() which appears to stumble on files that are in use. The stumble is now logged, rather than crashing, which is a step forward.
Python 3.3 introduced os.stat(), which allows access to the hidden flag on Windows. We don't need to support earlier versions of Python. So my proposal:
-
FileChooser's
is_hiddenshould be refactored to use:-
os.stat()andstat.FILE_ATTRIBUTE_HIDDENfor Windows -
os.stat()andstat.UF_HIDDENfor macOS - file starts with a dot for Linux, other platforms (and also for macOS too?)
-
-
FileChooser's platform-dependent imports can then be cleaned up.
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have the means to take action. Please reach out if you have or find the answers we need so that we can investigate further.