spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.3k stars 1.61k forks source link

OSError: [Errno 22] Invalid argument due to Onedrive #19458

Open thatpapitho1996 opened 2 years ago

thatpapitho1996 commented 2 years ago

Description

What steps will reproduce the problem?

om sjlkfas;dkghaoishgoih[ajjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj

Traceback

Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\editor\plugin.py", line 2199, in load
    finfo = self.editorstacks[0].load(
  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2613, in load
    text, enc = encoding.read(filename)
  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\encoding.py", line 308, in read
    text, encoding = decode( open(filename, 'rb').read() )
OSError: [Errno 22] Invalid argument

Versions

Dependencies


# Mandatory:
atomicwrites >=1.2.0          :  1.4.0 (OK)
chardet >=2.0.0               :  4.0.0 (OK)
cloudpickle >=0.5.0           :  2.0.0 (OK)
cookiecutter >=1.6.0          :  1.7.3 (OK)
diff_match_patch >=20181111   :  20200713 (OK)
intervaltree >=3.0.2          :  3.1.0 (OK)
IPython >=7.6.0               :  8.2.0 (OK)
jedi >=0.17.2;<0.19.0         :  0.18.1 (OK)
jsonschema >=3.2.0            :  4.4.0 (OK)
keyring >=17.0.0              :  23.4.0 (OK)
nbconvert >=4.0               :  6.4.4 (OK)
numpydoc >=0.6.0              :  1.2 (OK)
paramiko >=2.4.0              :  2.8.1 (OK)
parso >=0.7.0;<0.9.0          :  0.8.3 (OK)
pexpect >=4.4.0               :  4.8.0 (OK)
pickleshare >=0.4             :  0.7.5 (OK)
psutil >=5.3                  :  5.8.0 (OK)
pygments >=2.0                :  2.11.2 (OK)
pylint >=2.5.0;<2.10.0        :  2.9.6 (OK)
pyls_spyder >=0.4.0           :  0.4.0 (OK)
pylsp >=1.2.2;<1.3.0          :  1.2.4 (OK)
pylsp_black >=1.0.0           :  None (OK)
qdarkstyle =3.0.2             :  3.0.2 (OK)
qstylizer >=0.1.10            :  0.1.10 (OK)
qtawesome >=1.0.2             :  1.0.3 (OK)
qtconsole >=5.1.0             :  5.3.0 (OK)
qtpy >=1.5.0                  :  2.0.1 (OK)
rtree >=0.9.7                 :  0.9.7 (OK)
setuptools >=49.6.0           :  61.2.0 (OK)
sphinx >=0.6.6                :  4.4.0 (OK)
spyder_kernels >=2.1.1;<2.2.0 :  2.1.3 (OK)
textdistance >=4.2.0          :  4.2.1 (OK)
three_merge >=0.1.1           :  0.1.1 (OK)
watchdog >=0.10.3             :  2.1.6 (OK)
zmq >=17                      :  22.3.0 (OK)

# Optional:
cython >=0.21                 :  0.29.28 (OK)
matplotlib >=2.0.0            :  3.5.1 (OK)
numpy >=1.7                   :  1.21.5 (OK)
pandas >=1.1.1                :  1.4.2 (OK)
scipy >=0.17.0                :  1.7.3 (OK)
sympy >=0.7.3                 :  1.10.1 (OK)
dalthviz commented 2 years ago

Hi @thatpapitho1996 , maybe updating to Spyder 5.2.2 could help. For that, close Spyder and run from an Anaconda prompt something like:

conda update anaconda
conda install spyder=5.2.2

Let us know if that helps!

thatpapitho1996 commented 2 years ago

how do i do that

On Thu, Sep 15, 2022 at 3:15 PM Daniel Althviz Moré < @.***> wrote:

Hi @thatpapitho1996 https://github.com/thatpapitho1996 , maybe updating to Spyder 5.2.2 could help. For that, close Spyder and run from an Anaconda prompt something like:

conda update anaconda conda install spyder=5.2.2

Let us know if that helps!

— Reply to this email directly, view it on GitHub https://github.com/spyder-ide/spyder/issues/19458#issuecomment-1248510088, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3C4A6PVIC7CP432T3RENKLV6NYWNANCNFSM6AAAAAAQNQ7JUI . You are receiving this because you were mentioned.Message ID: @.***>

-- benjamin collazo

dalthviz commented 2 years ago

You should be able to launch the Anaconda prompt on Windows by searching it from the Start menu with the words Anaconda prompt. Then, from the Anaconda prompt console, you should run the commands described above:

conda update anaconda
conda install spyder=5.2.2
thatpapitho1996 commented 2 years ago

and let you know what i see? Is this an error you have seen with anaconda before?

On Fri, Sep 16, 2022 at 11:40 AM Daniel Althviz Moré < @.***> wrote:

You should be able to launch the Anaconda prompt on Windows by searching it from the Start menu with the words Anaconda prompt. Then, from the Anaconda prompt console, you should run the commands described above:

conda update anaconda conda install spyder=5.2.2

— Reply to this email directly, view it on GitHub https://github.com/spyder-ide/spyder/issues/19458#issuecomment-1249516936, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3C4A6MMV2RU2YBFDLPDMPTV6SIGVANCNFSM6AAAAAAQNQ7JUI . You are receiving this because you were mentioned.Message ID: @.***>

-- benjamin collazo

dalthviz commented 2 years ago

Yes, please try to update and check if the issue still occurs or if the update helped :+1:

Also, there have been some related issue in the past with a similar traceback yes (although quite old), you can check them here: https://github.com/spyder-ide/spyder/issues?q=is%3Aissue+text%2C+encoding+%3D+decode%28+open%28filename%2C+%27rb%27%29.read%28%29+%29+OSError%3A+%5BErrno+22%5D+Invalid+argument

thatpapitho1996 commented 2 years ago

the issue is still happening. What should i do?

it won't let me update anaconda or spyder.

it is saying that i should downgrad anaconda when updating

On Fri, Sep 16, 2022 at 2:49 PM Daniel Althviz Moré < @.***> wrote:

Yes, please try to update and check if the issue still occurs or if the update helped 👍

Also, there have been some related issue in the past with a similar traceback yes (although quite old), you can check them here: https://github.com/spyder-ide/spyder/issues?q=is%3Aissue+text%2C+encoding+%3D+decode%28+open%28filename%2C+%27rb%27%29.read%28%29+%29+OSError%3A+%5BErrno+22%5D+Invalid+argument

— Reply to this email directly, view it on GitHub https://github.com/spyder-ide/spyder/issues/19458#issuecomment-1249697375, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3C4A6NIAFLD4HJONIRQSXTV6S6M7ANCNFSM6AAAAAAQNQ7JUI . You are receiving this because you were mentioned.Message ID: @.***>

-- benjamin collazo

dalthviz commented 2 years ago

Maybe you could try to create a new conda environment using the conda-forge channel to install the latest Spyder version (5.3.3). For that, close Spyder, open an Anaconda prompt and run there something like the following:

conda create -n spyder-cf -c conda-forge spyder

The command above should create a new environment with name spyder-cf. Then to activate it and launch the installed version of Spyder from there, again from the Anaconda prompt run something like:

conda activate spyder-cf
spyder

You can also launch Spyder using the shortcut created with the environement. You can search for it typing Spyder (spyder-cf) on the Windows Start menu. Let us know if that helps with the issue, and if not, could you share an example file where this behavior happens for you and the steps you follow to be prompt with this error? Thanks!

thatpapitho1996 commented 2 years ago

that didn't work either

what should i do?

On Mon, Sep 19, 2022 at 8:27 AM Daniel Althviz Moré < @.***> wrote:

Maybe you could try to create a new conda environment using the conda-forge channel to install the latest Spyder version (5.3.3). For that, close Spyder, open an Anaconda prompt and run there something like the following:

conda create -n spyder-cf -c conda-forge spyder

The command above should create a new environment with name spyder-cf. Then to activate it and launch the installed version of Spyder from there, again from the Anaconda prompt run something like:

conda activate spyder-cf spyder

You can also launch Spyder using the shortcut created with the environement. You can search for it typing Spyder (spyder-cf) on the Windows Start menu. Let us know if that helps with the issue, and if not, could you share an example file where this behavior happens for you and the steps you follow to be prompt with this error? Thanks!

— Reply to this email directly, view it on GitHub https://github.com/spyder-ide/spyder/issues/19458#issuecomment-1251179155, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3C4A6N4EV3DV7OZXDBHEDLV7CA4PANCNFSM6AAAAAAQNQ7JUI . You are receiving this because you were mentioned.Message ID: @.***>

-- benjamin collazo

dalthviz commented 2 years ago

Are you by any chance trying to open a file inside a Dropbox or Onedrive folder synching? Also, could you share an example file or all the steps you follow in your setup to reproduce this in our side? Without that, I'm afraid there is not much we can do from the Spyder side, sorry :/

thatpapitho1996 commented 2 years ago

all files are from my school one drive account. could that be it? How would i provide the steps that you need?

On Thu, Sep 22, 2022 at 9:40 AM Daniel Althviz Moré < @.***> wrote:

Are you by any chance trying to open a file inside a Dropbox or Onedrive folder synching? Also, could you share an example file or all the steps you follow in your setup to reproduce this in our side? Without that, I'm afraid there is not much we can do from the Spyder side, sorry :/

— Reply to this email directly, view it on GitHub https://github.com/spyder-ide/spyder/issues/19458#issuecomment-1255282852, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3C4A6K3ZBGXVKHDSQ5KIGLV7SDY3ANCNFSM6AAAAAAQNQ7JUI . You are receiving this because you were mentioned.Message ID: @.***>

-- benjamin collazo

dalthviz commented 2 years ago

I see, then that probably could be the issue, checking a little bit around seems like Onedrive and other services to sync files could cause this while Spyder (or other application) tries to access the file Onedrive (in this case) could be syncing the file so making it unavailable for other programms. Could you check the Onedrive synching status, see if it updating/syncing something and either pause the synching or wait for it to finish before trying to access/working with the file with Spyder?

Let us know if that helps!

For more info about the Onedrive config to pause the syncing you can check https://support.microsoft.com/en-us/office/stop-syncing-a-library-with-the-onedrive-for-work-or-school-app-a7e41f1f-3a98-4ca7-9443-f10250688330 (the Pause and resume syncing a library section).

Maybe Spyder should catch this kind of exception and show a message indicating the possibility that Onedrive syncing is messing with files access @ccordoba12 ?

ccordoba12 commented 2 years ago

Maybe Spyder should catch this kind of exception and show a message indicating the possibility that Onedrive syncing is messing with files access @ccordoba12 ?

Yeah, that's a very good idea. Could you try to reproduce the error to see what could be the best way to do that?