Spyder: "Drag and drop" files from explorer does not work

Created on 31 Jan 2020  路  26Comments  路  Source: spyder-ide/spyder

Problem Description

Dragging any *.py from an Explorer window to the Editor panel, the cursor transforms into a "forbidden" symbol and the file does not open.

What steps reproduce the problem?

  1. Create an empty aaa.py file
  2. Try drag and drop it onto Spyder

Versions

  • Spyder version: 4.0.1
  • Python version: 3.7
  • Qt version: 5.9.6
  • PyQt version: 5.9.2
  • Operating System name/version: Windows10

Dependencies

atomicwrites >=1.2.0         :  1.3.0 (OK)
chardet >=2.0.0              :  3.0.4 (OK)
cloudpickle >=0.5.0          :  1.2.2 (OK)
diff_match_patch >=20181111  :  20181111 (OK)
intervaltree                 :  None (OK)
IPython >=4.0                :  7.8.0 (OK)
jedi =0.14.1                 :  0.14.1 (OK)
nbconvert >=4.0              :  5.6.0 (OK)
numpydoc >=0.6.0             :  0.9.1 (OK)
pexpect >=4.4.0              :  4.8.0 (OK)
pickleshare >=0.4            :  0.7.5 (OK)
psutil >=0.3                 :  5.6.3 (OK)
pygments >=2.0               :  2.4.2 (OK)
pylint >=0.25                :  2.4.2 (OK)
pyls >=0.31.2;<0.32.0        :  0.31.2 (OK)
zmq >=17                     :  18.1.0 (OK)
qdarkstyle >=2.7             :  2.8 (OK)
qtawesome >=0.5.7            :  0.6.0 (OK)
qtconsole >=4.6.0            :  4.6.0 (OK)
qtpy >=1.5.0                 :  1.9.0 (OK)
rtree >=0.8.3                :  0.9.3 (OK)
sphinx >=0.6.6               :  2.2.0 (OK)
spyder_kernels >=1.8.1;<2.0.0:  1.8.1 (OK)
watchdog                     :  None (OK)
cython >=0.21                :  0.29.13 (OK)
matplotlib >=2.0.0           :  3.1.1 (OK)
numpy >=1.7                  :  1.16.5 (OK)
pandas >=0.13.1              :  0.25.1 (OK)
scipy >=0.17.0               :  1.3.1 (OK)
sympy >=0.7.3                :  1.4 (OK)

Awaiting Followup

Most helpful comment

Sorry for not updating you on this issue for such a long time.
I discovered the issue is common not just to my PC, but also to all my colleagues' PCs.

I am working on it with the IT, but at the moment IT has more urgent things to do in order to support the massive increase in network activity due to all the people working from home.

I will post here as soon as I have an update.

All 26 comments

This is similar to #10844 but happens with any file.

This is somehow related to #10694 but no error appears in the console

@dalthviz, please take a look at this one.

For other reasons, I just unistalled Anaconda and Python completely and re-installed everything, including Spyder 4.0.1
The error was present both before the clean-up and is still present in the new installation.

@ccordoba12 @pj1989 I tried to replicate this but the drag and drop is working for me:

drag

@pj1989 could you upload a GIF to understand better the way the issues is happening to you? Thanks!

@dalthviz, could you try to drag and drop files from a directory with non-ascii (i.e. Chinese or Arabic) characters?

spyder_drag_and_drop

@dalthviz, could you try to drag and drop files from a directory with non-ascii (i.e. Chinese or Arabic) characters?

This is not my case, as I tried to show in the gif

@dalthviz, do we have logging messages that would allow us to debug this?

I was checking but seems like we don't have any. Probably @pj1989 would need to add some print statements in CodeEditor and EditorStack inside the reimplementation of the dragEnterEvent to check the event mime data.

@dalthviz, please add the messages we need to debug this as a first step. Then, after releasing 4.1.0, @pj1989 could send us those logs so we can fix this problem.

Happy to help you with the debug of this. Let me know if you want me to modify any code or to download a dev version.

Thanks @pj1989 ! Could you try to run Spyder with the --debug-info verbose flag from the PR #11462 ?

You would need to checkout the branch I'm working in that PR and run from there with something like python bootstrap.py -- --debug-info verbose

Also @ccordoba12 seems like we reach a debug line that exists in a check if the file is binary when doing the dragEnterEvent (I notice it after adding the debug lines in the PR). Could be possible that the file is being recognized as a binary?

@dalthviz Could you advise me on how to install branch dalthviz:debug_issue_11447 in a separate conda environment? I use spyder for other work-related tasks and I don't won't to corrupt the installation in the base environment.

PS; is it possible to have a private conversation on github? Is there anything like PMs?

@pj1989 you don't need to install anything than could affect your conda environments, but you will need to know a little bit of git and have git installed of course. Probably the simplest way to get the logs could be as follows:

  1. Clone my fork running from an anaconda prompt git clone https://github.com/dalthviz/spyder.git
  2. Change the current directory of the console to the repository directory: cd spyder
  3. Under the repository directory execute git checkout debug_issue_11447
  4. Then, run python bootstrap.py -- --debug-info verbose (this should launch Spyder).

If you want to create another env you should execute something like: conda create -n <new env name> spyder=4.0.1, where <new env name> is the name of the new environment you want to create. Then you could activate it with something like conda activate <new env name>, and follow the steps above.

However, if this seems a little bit overwhelming don't worry, you can wait for the new version of Spyder (4.1.0) to be available and then submit the logs in this issue as @ccordoba12 suggest initially.

About private conversations, sorry that's not possible using github.

Hi @dalthviz

The problem persists in 4.1.0.dev0 (I'm not sure if you already changed something to fix it, but at least this allow us to debug it).

The bad news however is that during the drag-and-drop event, no line is written on the console.

Here I attach a new gif and the log
spyder_drag_and_drop
debug_log.txt

Thanks @pj1989 for the feedback! I think I understand what's happening here and a way to reproduce this (basically running Spyder as an Administrator):

drag

Are you running Spyder as an Administrator? Seems like Windows prevents interactions between apps with different levels of privileges: https://stackoverflow.com/a/37877549 and https://stackoverflow.com/a/52988006

But then I'm unsure if we can do something here :/

What do you think @ccordoba12 ?

I'm not running it as Administrator. At least, not explicitly. I'm just using the shortcut in the start menu in the Anaconda folder. The issue was present also when running it from the anaconda prompt with python bootstrap.py.

Neither I'm running explorer as administrator.

Maybe some company security settings?

It could be possible that it is some security settings. Do you know how Anaconda was installed? Maybe it was installed with Administrator rights?

It shouldn't. I did a normal installation using the executable on their website.

I checked using the method described here if either Explorer or Anaconda were running with Administrator rights. But apparently neither of them does.

EDIT: Neither the pythonw.exe nor QtWebEngineProcess.exe appears to be "elevated" also when running explicitly with Administrator rights. Do you have any idea how I can check?

image
image

Maybe this process explorer could help to check the integrity level used by the explorer.exe and Spyder (pythonw.exe) (you need to activate the Integrity column):

When running Spyder as an Administrator (the way I manage to make drag&drop fail):

  • explorer.exe -> Nivel obligatorio medio -> Medium integrity level -> Normal user
  • pythonw.exe -> Nivel obligatorio alto -> High integrity level -> Administrator

image

When running Spyder normally (drag&drop works normally for me):

  • explorer.exe -> Nivel obligatorio medio -> Medium integrity level -> Normal user
  • pythonw.exe -> Nivel obligatorio medio -> Medium integrity level -> Normal user

image

Searching seems like Windows manages multiple levels of integrity since Windows Vista and normally an application is launched with a medium level. Maybe, for security polices, your explorer is launching from a low integrity level causing Windows UIPI to prevent the drag and drop (elements from a low integrity level context can't access higher integrity levels)? If that not the case I'm out of ideas (at least for now).

Amazing! Spot on!

Now, however, I have another question: why Spyder is launched as administrator? Did I do something wrong during the installation? Is there a setting that I need to change?

Thank you very much

image

The shortcut is not set to "Run as administrator".
I'm looking around, but I cannot find any useful setting
image

Sorry. I clicked the wrong button by mistake

Hi @pj1989, maybe some how your Anaconda installation required Administrator rights (for example for the location of the installation) and now anything launched from Anaconda inherits such privileges (at least at the integrity level). Maybe, as a test, you could try to launch something else like Anaconda Navigator and check if the python related processes end up having a high level on integrity with the process explorer tool

Sorry for not updating you on this issue for such a long time.
I discovered the issue is common not just to my PC, but also to all my colleagues' PCs.

I am working on it with the IT, but at the moment IT has more urgent things to do in order to support the massive increase in network activity due to all the people working from home.

I will post here as soon as I have an update.

No problem @pj1989.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

spyder-bot picture spyder-bot  路  3Comments

impact27 picture impact27  路  3Comments

hedeqing picture hedeqing  路  3Comments

keith-golden picture keith-golden  路  3Comments

danieltomasz picture danieltomasz  路  3Comments