These are chat archives for spyder-ide/public

11th
Oct 2018
swethakolur
@swethakolur
Oct 11 2018 05:47
Hi, i'm trying to run a selenium script in spyder, it runs till a certain point n then it exits the program randomly without any error. how do i resolve this?
CAM Gerlach
@CAM-Gerlach
Oct 11 2018 05:52
@swethakolur Does the same result happen if you run the script in a standard Python interpreter in the same environment as Spyder? Otherwise, we have no idea without seeing the script, having a more detailed description from how of how it behaves and what it does, and exactly at what point does it exist. Even so, if we can isolate the cause to something specific to Spyder there's not much we can do, unfortumatly.
swethakolur
@swethakolur
Oct 11 2018 05:54
you mean running the same script on other interpreters ?
im trying to send you a screenshot of the issue and script . unable to do that here
CAM Gerlach
@CAM-Gerlach
Oct 11 2018 05:55
Just running the script in the standard Python interpreter in whatever environment that copy of Spyder was installed in. Like python your_script_name.py

unable to do that here

Why not? Simply copy and pasting the image didn't work?

swethakolur
@swethakolur
Oct 11 2018 05:56
i am using it through anaconda
no copy paste isnt working
CAM Gerlach
@CAM-Gerlach
Oct 11 2018 05:56
Are you using an old browser or something? I've never had any problem with it on any reasonably recent version of Firefox...
swethakolur
@swethakolur
Oct 11 2018 05:57
im using chrome
CAM Gerlach
@CAM-Gerlach
Oct 11 2018 05:57
image.png
Nope, still works fine
swethakolur
@swethakolur
Oct 11 2018 05:57
no idea why it isnt working
CAM Gerlach
@CAM-Gerlach
Oct 11 2018 05:58
Are you sure you're doing it right? Copy the screenshot, then hit Ctrl-V in the Gitter textbox? I've done it on lots of other websites too with no problem. What OS are you running?
swethakolur
@swethakolur
Oct 11 2018 05:58
yeah im doing it the right way
windows
7
is there any other way i can send you the script? like mail or something?
CAM Gerlach
@CAM-Gerlach
Oct 11 2018 06:00
Oh you're trying to paste the script file???
swethakolur
@swethakolur
Oct 11 2018 06:00
no the screenshot
i can copy paste text
but idk why i cant do the same with image
CAM Gerlach
@CAM-Gerlach
Oct 11 2018 06:02
Seems totally inconceivable that a basic Gitter feature wouldn't work on the world's most popular browser. I'm even running my browser in a VM and it still works copying through from my host OS.
Anyway, this all is immaterial since before we look at any script, we need to know whether it works in a standard Python interpreter in the same environment you're trying to run it in Spyder, as I've asked for several times.
Can you please report the results of that? Thanks!
swethakolur
@swethakolur
Oct 11 2018 06:03
running it through anaconda prompt?
CAM Gerlach
@CAM-Gerlach
Oct 11 2018 06:04
Yes, with whatever environment you're trying to run it in within Spyder (either base or a custom one).
swethakolur
@swethakolur
Oct 11 2018 06:04
okay will try and report the results. Thank you
CAM Gerlach
@CAM-Gerlach
Oct 11 2018 06:05
Thanks.
Felix
@felix4webscience
Oct 11 2018 06:55
@swethakolur, have you tried different formats? Maybe only jpg or png is working but not tiff?
CAM Gerlach
@CAM-Gerlach
Oct 11 2018 06:56
Good thinking, but its a screenshot, which should always be PNG on any remotely modern OS.
swethakolur
@swethakolur
Oct 11 2018 07:01
@felix4webscience , its in PNG format
CAM Gerlach
@CAM-Gerlach
Oct 11 2018 07:02
@swethakolur Anyway, back on topic, what was the result of running the script with the standard Python interpreter?
Felix
@felix4webscience
Oct 11 2018 07:02
was just an idea, sometimes its a reason on other plattforms
swethakolur
@swethakolur
Oct 11 2018 07:03
@CAM-Gerlach its not running at all
even the scripts which work fine
aren't running
paging = browser.find_element_by_xpath('//*[@id="devicedetmid1"]/tbody/tr[4]/td/ul/li[11]/span[1]')
paging.click()
time.sleep(10)
browser.switch_to_default_content()
browser.switch_to_frame("OpsIframe")
edit = browser.find_element_by_xpath('//a[starts-with(@id,Sec0)]')
this is the snippet of the code
it works fine till switching the iframe
n then immediately it just stops
without any error, kernel goes to the next In
CAM Gerlach
@CAM-Gerlach
Oct 11 2018 07:05

its not running at all

You mean when run with python in the same Anaconda environment as Spyder?

even the scripts which work fine
aren't running

Scripts which work fine where aren't running where? Please be specific and explicit if you want to get accurate help.

swethakolur
@swethakolur
Oct 11 2018 07:07
@CAM-Gerlach yes in the same environment. i tried running the script which was running fine in spyder through the interpreter, it just didnt wotk
work*
CAM Gerlach
@CAM-Gerlach
Oct 11 2018 07:08
Didn't work in what?
swethakolur
@swethakolur
Oct 11 2018 07:08
work in the interpreter
In [6]: runfile('C:/Users/user/.spyder-py3/paging.py', wdir='C:/Users/user/.spyder-py3')
Current OTP: 551772
In [7]:
Felix
@felix4webscience
Oct 11 2018 07:09
and you are using the same python versions and not 2.7 in the one and than 3.5 in the other one?
CAM Gerlach
@CAM-Gerlach
Oct 11 2018 07:09
Okay, thanks. If that's the case, then that has nothing to do with Spyder but is rather likely user error or another such issue with your Anaconda environment.
swethakolur
@swethakolur
Oct 11 2018 07:10
@felix4webscience i guess yes
@CAM-Gerlach okay
Felix
@felix4webscience
Oct 11 2018 07:11
have you tried to run it in in jupyter as well?
swethakolur
@swethakolur
Oct 11 2018 07:11
@felix4webscience no. i will try that
CAM Gerlach
@CAM-Gerlach
Oct 11 2018 07:11
Spyder is only an IDE (written in and for Python); we don't have any direct control over the specific Python environment you choose to run your code in. That said, we will make that easier to manage in Spyder 4.
swethakolur
@swethakolur
Oct 11 2018 07:13
okay. i have upgraded spyder and anaconda too. but its just weird that program is exiting without any error
CAM Gerlach
@CAM-Gerlach
Oct 11 2018 07:14
If it doesn't run in the baseline Python interpreter in the same environment, it is rather unlikely to run in something built on top of it, like Jupyter Notebook (if that's what you're referring to), Jupyter QtConsole, IPython or Spyder. However, if it doesn't, that provides even stronger assurance that the problem is with your code, your packages or your environment setup than anything to do with Spyder.
CAM Gerlach
@CAM-Gerlach
Oct 11 2018 07:19

okay. i have upgraded spyder and anaconda too. but its just weird that program is exiting without any error

Its still not clear what this actually entails—how do you mean, "exiting"? What specific behavior is this? Do any variables appear in the Variable Explorer (after disabling the "hide unsupported types" from the gear menu)? Are you able to interact with them in the Console? What do you expect your program to do that it isn't? How, specifically, does your program behave differently in Spyder vs. another interpreter in the same Python/Anaconda environment? Does the program involve anything GUI-based (that's the main scenario where you're likely to see any difference with Spyder)? These are all questions for you to ask yourself and work through on your own in debugging your code and understanding how your expectations line up with what's actually happening, rather than anything to actually answer directly to me (since again, it appears this problem really doesn't have much to do with Spyder).

Felix
@felix4webscience
Oct 11 2018 07:22
can you not open a github repository and enter your code in there? Its hard to advice you without seeing the error message which appears... another forum, which might be good to look around is: stackoverflow.com and maybe your will find your answers if you search for problems with the selenium library...
if you using selenium, there might be other problems as well, like you haven't entered gecko in the right directory or something like that...
CAM Gerlach
@CAM-Gerlach
Oct 11 2018 07:23
@swethakolur Also, I encourage you to read and follow the zen of python (import this), particularly the mantra "Explicit is better than implicit`` which is particularly important when asking for help.
Felix
@felix4webscience
Oct 11 2018 07:24
@C.A.M. Geralch, may I ask you a little question too?
CAM Gerlach
@CAM-Gerlach
Oct 11 2018 07:24
@felix4webscience All great points; thanks for helping. As you've mentioned, it certainly doesn't sound like an issue for here and could easily be a misunderstanding of something like that.
Sure, ask away.
Felix
@felix4webscience
Oct 11 2018 07:25
I have a problem with the indentions..., there are always 5 instead of 4,..., can I change that?
I am using Spyder 3.3.1 - I have tried to use "Source >Fix indentions" but actually it doesn't do anything...
CAM Gerlach
@CAM-Gerlach
Oct 11 2018 07:26
@felix4webscience Check under Preferences > Editor > Advanced Settings > Source Code > Indentation Characters

Source Fix indentions

This is very misleadingly named (I actually opened the original issue about it, and others have brought it up since). All that does is convert mixed tabs and spaces to all spaces.

Felix
@felix4webscience
Oct 11 2018 07:29
But I am confused about it, I change that from "Indentation characters: 5 spaces -> to 4 spaces and now its doing 3 spaces ? How is this function expect to be working?
oh, and sorry where can i find the origin thread? could you enter a link? I will read through that one...
CAM Gerlach
@CAM-Gerlach
Oct 11 2018 07:31
So it was originally 5 spaces which explains your original problem. However, if you are sure you've set it to 4 spaces but yet pressing Tab from the left margin gives you three spaces, then that's a bug and should presumably be reported.
Felix
@felix4webscience
Oct 11 2018 07:32
grafik.png
is this the correct setting?
CAM Gerlach
@CAM-Gerlach
Oct 11 2018 07:33
If you want 4 spaces, yes. Are you sure you're getting 3 spaces and not 4 doing a brand new tab from the left margin?
Felix
@felix4webscience
Oct 11 2018 07:35
hm, well, I need to discover this issue in more detail...because right now, it worked... Yesterday it worked as well for the first few lines and than it changed backk to five...
Thank you anyway...I have save the thread and if I have more details about it, than I post it there
have a nice day
CAM Gerlach
@CAM-Gerlach
Oct 11 2018 07:37
As mentioned, that issue is not related to any issues with the number of spaces for indentation. It just converts tabs to spaces in Python files with mixed tabs and spaces.
Its almost 3 in the morning here, but okay :)
Felix
@felix4webscience
Oct 11 2018 07:38
hehe, its 9:40 in Europe...sunny autumn day...
CAM Gerlach
@CAM-Gerlach
Oct 11 2018 07:47
Here in Alabama in the US we've got a major hurricane a few 100 km away, heh...not too bad here though.
tmdzd
@tmdzd
Oct 11 2018 19:36
Hi guys, how am I stop running a code in spyder? I wrote a code require about 10s to calculate, sometimes I want to stop it, how can I do ot? I've tried crtl+c and it didn't work
CAM Gerlach
@CAM-Gerlach
Oct 11 2018 19:38
@tmdzd Did you try the stop button?
image.png
tmdzd
@tmdzd
Oct 11 2018 19:38
yes , and it become gray, but code still running
CAM Gerlach
@CAM-Gerlach
Oct 11 2018 19:41
Ah, well then that's likely spyder-ide/spyder#8013 . Are you running under Python 3.7?
tmdzd
@tmdzd
Oct 11 2018 19:43
yes, it's Python 3.7, I shall check that, thank you
CAM Gerlach
@CAM-Gerlach
Oct 11 2018 19:46
Sorry you're having trouble, but hopefully we'll fix it soon!