Why am I seeing attributes twice in the dropdown menu in Jupyter Notebook? - python-3.x

Each time I load up a Jupyter Notebook in Python, it works fine, BUT I am seeing options from the dropdown menus (when pressing tab) twice. I am trying to figure out why this is and correct it. I have included a screenshot to illustrate what I mean more clearly.
One idea is perhaps that I have multiple instances of Python running? Is that possible? Other than that I am not sure how to investigate and find out what is causing this so that I can correct.
Any ideas, direction or overall solution appreciated. Thanks!

Related

VS Code input and variables don't show frequently in Interactive window

I have started using VS Code for work instead of Anaconda and there are some weird observations which I am not able to figure out.
If I try to execute some code in a cell in the interactive window, many-a-times, only output remains available and the input code automatically gets hidden. For eg. I type the following and execute:-
And this is what I see at the window:-
Similarly, there are some variables which I have already defined but they don't show up in the Jupyer:Variables tab. For eg. there is a variable _link_name_to_index which is not visible in the tab as shown below:-
However, when I execute the same in the window, I can see the values of the dictionary as expected:-
Maybe it is just a matter of some settings, but I still couldn't find out which one. Also, I know I have put a lot of images, because it is not a code doubt as such, rather more of a tool doubt. I have taken only one particular example here, but I face this issue often. I am using VS Code version 1.75.0 in Ubuntu 20.04, using Python 3.9.12 in a virtual environment, if it helps.
This is a bug in the latest Version of VSCode (1.75). It is tracked in this issue. For now, the only option seems to be downgrading to v1.74.x

Why does the function definition and doctring show twice when I hover over the function in VS Code? How to resolve to showing once?

On hovering the mouse pointer over a function, whether inbuilt or custom, the definition and docstring of the function shows as expected, however it shows twice. I have had a search for what might be causing this and looked around my settings, but have yet to find a reason for it. If it makes a difference, am using Python on VSCode.
Perhaps someone knows what might be causing this and how to resolve? I have not attached any images, since I think the issue is quite clear, but happy to provide if needed for clarification.
Thanks!
Disabling the Jupyter extension seems to fix it for me.
Update: Enabling the Jupyter extension and setting this also does the trick:
"jupyter.pylanceHandlesNotebooks": false
Not sure still what caused the issue, but disabling and then re-enabling the Pylance extension has solved this. Thanks.

Jupyter Notebook didn't save for over a day. How can I recover lost work?

I've lost a day's work in Jupyter Notebook because it didn't autosave. As I was working, I would click on File > Save and Checkpoint to be safe. I closed the notebook when I finished working and when I tried reopening it, I see that essentially all my work is gone and it says Last Checkpoint: a day ago (autosaved) next to the filename. I now realize that I had been working for a long time on the notebook with an orange box with some kind of error message. I'm sorry that I can't remember the specific message right now, but I think it was something involving POS or POST or POSIT ...?. I saw Trusted next to the error message, so I must've thought things were OK.
I tried opening the filename-checkpoint.ipynb file within the .ipynb_checkpoints folder but it's blank. I looked up a possible solution on Recovering from a Jupyter Disaster, but it requires SQL, which I don't know. Is there any hope for recovering my work? I realize that this is probably a rookie mistake, but I'm pretty new at this.
Thanks
PS: I'm running Python3 on MacOS
Hope you've already found how to recover lost work from Jupyter notebook work. If not, try the following:
Go to Anaconda Navigator (the green circle!)
Launch a Jupyter Lab
In Jupyter Lab, open a Terminal window
Launch iPython in the terminal by typing ipython and hitting enter
Hit Up arrow
All your code are stored in history and each cell compilation that you would've done in the past shows up there.
Copy+Paste it back to a new Jupyter notebook and you are ready to go again!
If you want to copy/paste.
After running terminal and ipython, page_up yo code you want. Click right button on a mouse, then Watch the elements code. Now you can select code, copy and paste it.
If you don't have Anaconda Navigator you can do access the same data the manual way:
open a new ipython terminal
type %history -g -f history.txt
This will output the entire history of edits which are saved in history.sqlite in your IPython profile folder. You can scroll down to the bottom to find your most recent edits.
You can also just explore the history.sqlite directly, which is located in your IPython profile. The profile should be inside .ipython in your user directory (windows and linux).
Thanks to Christian Long's answer on another question for providing this info.

Python 3 & Tkinter buggy and slow

So, a few months back I made a small GUI for handling NPCs in a roleplaying campaign I was running. I haven't touched in since then, except that now I need it! Tomorrow, in fact...
I have a few odd error... Loading the GUI seems to work fine, but when I start to press buttons the troubles start. It seemed, at first, that it the script was very slow, which it shouldn't be, calling a two line dice function on a button press. I accidentally figured out that when I hover the mouse over the "close/minimize window" buttons (not in the GUI, but in the OS), the button would update with the result of the button press.
The same thing happens with a listbox I have: choosing an item may or may not select the item straight away (but hovering over the close/minimize updates it), and the results of the selection may or may not show. The results is in fact weirder: selecting a listbox item is supposed to get info from the selected item and print it in another frame. Even if the selection itself is fine without hovering, the printed text is somehow "clipped", showing only an area seeming to cover an arbitrarily sized square of text... Remedied by hovering, of course. The rest of the GUI have the exact same problems.
I have no clue what is going on here. The script was written on another computer, but that was also a Mac running the same OSX version (Mavericks), and it was a MUCH slower computer. This script shouldn't need any sort of advanced specs, though! I'm guessing it's something wrong with migrating to the new computer and the various version of different software? I'll paste the script down below, in case that'll help somehow.
Any help would be greatly appreciated, especially if it comes before the next epic campaign of Superheroes starts tomorrow afternoon! =P
[UPDATE]:
It was some time ago, but I still would like to have this problem solved. I've reduced my script to just a simple button, and the problem persists: clicking the button, even though there is no function or anything associated with it, only results in the frozen "button-clicked"-colour (i.e. light blue on OSX Yosemite), and I have to hover my mouse pointer over the close/minimize/etc. buttons in the top left corner to make it go back to "idle-button"-colour (i.e. grey).
#!/usr/bin/python
import tkinter as tk
root = tk.Tk()
test = tk.Button(root, text='test')
test.pack()
root.mainloop()
So, the problem obviously isn't with any of my "downstream" scripting, but something with the module or my way of calling it. Calling the script for the Terminal doesn't give me any error messages, and the problem is still there. Any ideas? It would be really, really good to get to the bottom of this problem!
I had the same problem when using Tk 8.5.13 on Mac OS X Sierra (10.12.3) with Python and IDLE v3.6.0.
Upgrading to TCL/Tk 8.5.18.0 as recommended on the Python Software Foundation page https://www.python.org/download/mac/tcltk/#activetcl-8-5-18-0 seemed to do the trick. This was the recommended version for my edition of the OS.
The interface I was building starting responding as I would expect, i.e. straight away when one of the controls was used. The only reservation I have so far is that normal buttons don't seem to have any sort of animation now, although the buttons do actually work.
-S.

Dreamweaver Coding Hint won't go away

I've had this issue several times and usually I can just shut down the program and restart it. But this time I have a bunch of windows open and I don't want to restart Dreamweaver.
My problem is that Dreamweaver brought up a code hint, but the code hint box now won't go away. It just sits there floating in the middle of the page. It doesn't matter if I click to Preview or any other tab in Dreamweaver, it still just sits on top of everything.
I'm working on a Mac, Dreamweaver CC (cloud, fully updated). Anyone else have this problem???
This has been a HUGE PAIN for me as well! You can make the code hint disappear though by finishing out an element that is in the code hint box. For instance if the code hint box appears and you can see class in the drop down... create a <div class="xyz"> real quick and the code hit box will dissipate after you close the quotes on the class because you used an element in that box. As to why this continually happens on the Mac version I have no idea, but I hope they fix it soon!
It's a known bug since years as you can read here: https://forums.adobe.com/message/7745689
Someone suggests as a workaround to set the Coding Hint delay to 0 (as said here: https://forums.adobe.com/message/7745689#7745689) but for me, in Dreamweaver CC 2015 Windows fully updated via cloud app, this bug still occurs while I code JS files.
Awaiting for a final fix, I hope this suggestion can be useful for you on Mac. :)

Resources