A little context
I'm using Windows. I installed Python and wrote a script for it. Before long, it became necessary to install packages. To do so, I needed to know what was the location of my Python folder, so that I could enter this location in the command prompt as in this video at 7:55. My idea for how to achieve this was to go into the "This PC" app (as in, enter the words "This PC" into the search bar which is next to the start symbol in the lower left-hand (LLH) corner of the screen) and search within that app the phrase "Python" (as in, enter "Python" into the search bar which is in the URH corner of the window which is opened when the symbol "This PC" is clicked). Then, I just made a new folder titled 'Python 3.7' on my desktop and dragged all of the search results into that new folder.
Slightly more detailed explanation of the problem
Now, everything can be found in that folder, and I find it to be reasonably organized, but most things no longer function if I attempt to click on them. For example, clicking on the 'IDLE (Python 3.7 32-bit)' shortcut has no effect whatsoever. The shortcut which I have pinned to my taskbar also inexplicably no longer does anything when it is clicked. Going to the .py script I wrote, right clicking, and selecting "Open" has no effect; on that same menu, selecting "edit with IDLE" opens a window asking "How do you want to open this .py file?" I select the option "Python" and click OK, and nothing happens.
What I expect to be the most relevant information
The thing titled 'IDLE (Python 3.7 32-bit)' which I click on is categorized as a Shortcut. When I right-click and go into the properties, it says the Target Location is
Python37-32
which is a folder. It further says Target:
\Programs\Python\Python37-32\Lib\idlelib\idle.pyw"
and Start in:
"C:\Users\Myname\Desktop\Python 3.7\python\Python37-32\"
whereas the current location of the Shortcut is
C:\Users\Myname\Desktop\Python 3.7
Essentially, I have rearranged folders without much thought, and inadvertently messed something up?
Does someone happen to know, at least, what this issue is - or, perhaps, to be so gracious as to refer me to a help page on the subject - so that I may research the issue?
Related
My python interpreter version does not show up at the bottom of the status bar on VS code on my Mac, it used to but suddenly stopped. Everything works but it just doesn’t show, I tried many possible solutions such as:
right clicking the bar to have the Python Extension checked (which I don’t even have an option to check)
uninstalling all the extensions then reinstalling it but it didn’t help. Even after restarting my computer.
I also can't seem to add python.pythonPath in my settings.json file if that has something to do with it and if it does how can I get that? When I try to add that in my VS code settings.json, it says 'unknown configuration"
Basically I would just like to see the python version on the status bar.
status bar on vs code
Turned out it was placed to a new place in the status bar.
Here's how to pin it on the status bar now:
Hover over the {} next to the Python language chooser
Click the pin icon
The selection of the Python environment becomes pinned to the status bar on the right hand side
Have a look at the current v1_64 Changelog https://code.visualstudio.com/updates/v1_64 and search for Status bar. It seems like it has been experimentally moved to the right beside the Language status and is obviously not that clear anymore as it is just a {} in my case. When hovering over it, it reveals the current selected interpreter.
The new python environment selection button had been moved to the bottom-right of the status bar, at first, I tried to disable and enable the Python extension several times and I cannot find the button at the original bottom-left of the status bar. Then I kept using Cmd + Shift + P to search and manually select python interpreter before I noticed the new position of that button.
First, make sure that your load status is checked in vscode.
from View> Appearance> Status Bar
Picture one
Then go to the status bar and these two options should be checked like in the picture.
Picture Two
Press the Shift + Ctrl + P like picture and Write Python: Select Interpreter then Hit the Enter
Picture Three
Choose recommended or global interpreter.
Picture four
If you don't see any interpreter version in the status bar like this picture, make sure you have at least one Python file open in vscode.
Picture five
Now when you open a Python file, you will see the version of the Python interpreter in the status bar.
Picture six
I hope it works
I'm fairly new to python, and I am trying to run the code I wrote when I right click the playback range windows in the timeline of maya (where you type your min or max range) . I managed to find ways to run scripts within the attribute editor / timeline / shelf items, but I cant seem to figure out how to interact with Maya's UI... Even typing a new value in there doesn't update the script editor, so I don't really have a lead on where to go. Any help would be fantastic!
you basically want to add a menu item in the timeslider ?. You can get all maya widget using OpenMayaUI.MQtUtil and here is a full repo which modify timeline control https://github.com/robertjoosten/maya-timeline-marker
Everything Maya does when using the UI logs data in the script editor.
Many items in the log are suppressed though as it would spam the log.
To enable it, activate Echo all commands (can be found in script editor under History), then clear the script editor and perform the action you want logged.
You will find that Maya executes a lot of mel script functions, which you can all find in the maya install directory under [MAYA_INSTALL_DIR]/scripts/startup and [MAYA_INSTALL_DIR]/scripts/others
To find the essential function you will have to search a little through the log.
Once you got a mel function you want to look for, I recommend using a find in files search function like the one in Notepad++, to find the corresponding .mel file in which the global proc is defined.
Also note that UI element names that are logged in script editor may have a different name the next time you start maya. So you will have to add functionality to search for the correct UI element name.
The Maya mel scripts are a good resource to find out all sorts of things about how the UI works, including contextual marking menus and the commands of tool windows.
Apologies in advance for what should seem obvious to me...
New to Python, but other wise very experience, hence the frustration.
As I'm learning, I'm attempting to prototype the command at the command prompt (">>>") as I script. I can enter the python commands and validate they are correct, but (currently) then have to retype the command in to sublime, which seems inane, especially as I'm watching videos where they are copying and pasting one to the other...
Windows 7 CMD, & Python ">>>" command lines, Sublime window
I'm trying to copy commands from the Python command line ">>>" to the sublime editor in an open/new tab. Normally, I would mark/highlight the selection, then Ctrl+c, place the cursor in the target window (sublime in this case), Ctrl-v, and be done.
However, I'm unable to select what I want to copy (??). Up/down arrows will recall the individual lines (no problem with that) -- where I would usually do a Ctrl-(left/right arrow) to select the text, but no indication that anything has been selected. Same result using the mouse.
Thanks in advance for the assist.
This is an oddity of the Windows command prompt. First, there is a little bit of setup. Then you can do the cut-and-paste in a slightly different way than you are used to.
Setup
Right click on the title bar at the top. Select "Properties". Click on the "Options" tab. Make sure that the "QuickEditMode" box is checked. Close the Properties window.
Cut-and-paste should be enabled, but not using control-C to cut. Select the text you want to copy. Instead of typing control-C, just hit return (with the desired text selected). The text should now be on the clipboard to paste into other applications (with control-V)
In Linux terminals, pressing Ctrl+k copies everything in the line that follows the cursor. Ctrl+u copies the everything before the cursor.
Please image such a situation: A local file's icon is displayed in a GUI, right click the icon, a context menu pops, with the option: show file in explorer. Click the option, then a explorer window opened, with the particular file selected. Many editors have such a feature: show in folder or show in explorer
In fact, the GUI is built by PyQt, my first thought is simple, just open a subprocess and pass the command line:
explorer /select, a_full_path_name
The behavior is indeed what I need, but when click "show in folder" again, a new explorer window will be opened, even the old one exsits! How about a naughty boy clicking "show in folder" dozens of times in a breath? So I need just one window, if an old one exists, just raise it to the front.
The command start /D a_path . may disappoint the naughty boy(run it several times, only one window.) however, there is no option to highlight a selected file, thus also disappoint me...
As mentioned above, many editors have such a "show in folder" feature,
but to my suprise, PyCharm "Show in Explorer" will open multiple windows with multiple clicks on the same file, and also the CodeBlocks "opening containing folder", however programmer's notepad "open containing folder" will always open just one folder on the same file.(To be honest, I have only the 3 editors in my PC except the windows notepad :)
My Question:
Can the feature mentioned above be achieved just by windows cmd?
If can not, Is there a python way to achieve that?
In fact, I found several related questions in stackoverflow, for example,
but my problem is unsolved, would somebody give me a ride?
Finally, some nice guy guided me to the answer.
It's from https://github.com/exaile/exaile/blob/master/xl/common.py#L350
in py3+
import ctypes
ctypes.windll.ole32.CoInitialize(None)
upath = r"C:\Windows"
pidl = ctypes.windll.shell32.ILCreateFromPathW(upath)
ctypes.windll.shell32.SHOpenFolderAndSelectItems(pidl, 0, None, 0)
ctypes.windll.shell32.ILFree(pidl)
ctypes.windll.ole32.CoUninitialize()
in py2+
Just give a unicode path.
note: ILCreateFromPathW (Unicode) and ILCreateFromPathA (ANSI)
IDLE is being very dodgy as to when it will actually show an Auto-complete menu. As of late it hasn't been working at all, or, more specifically, only works during an interactive session.
I've been using Code Blocks for C, and have gotten really used to the very nice auto-complete features, so it's a bit frustrating not having them -- especially while trying to learn a new frame work and what class is associated with which methods, etc, etc..
Is there an easy fix to get IDLE auto-complete working again? I'm using python version 2.7.
Is there perhaps a simple editor I should look into? I've tried Vim, which was a little too heavy for my simple needs, Ninja, which I couldn't get to work for anything, and Sublime text 2, which I couldn't get my wxpython stuff to play with. What would a nice option be? Anything similar to Code Blocks would be cool, although, I'd be perfectly happy with IDLE if it would consistently work!
REQUESTED CLARIFICATION:
OK, so it seems I may have some of my terminology backwards. By non-interactive, I mean, for instance, right clicking on a python file and selecting "edit with IDLE". This brings up what I guess could be described as a text editor. You can enter all you code here. Once ready, you then hit F5, or select Run, and it launches (what I've been referring to as) the interactive terminal. It's here that you can type in code, press return, and instantly have that code evaluated.
What my question is referring to it the former, the part of IDLE where you edit the code. Sometimes while typing, after a . it will display the available methods, or after an open parenthesis it'll give hints as to the values expected. but the thing is, sometimes it does these things, sometimes it doesn't.
The only thing i found so far is that if an editing session of IDLE is connected with python shell (called "interactive mode" in the question, i.e. after an attempt to run the edited script) then "non-interactive" IDLE can autocomplete based on values in interactive window. For example, if I type
a = [];
a.appen
and then hit < Tab > it will do nothing, but if I previously type
a = []
in corresponding python shell, IDLE will autocomplete correctly.
So my only suggestion is import same modules with same names in python shell window in order to make them "visible" for non-interactive IDLE editor.
I had the same problem with IDLE, because I want to learn Qt and therefore autocompletion is very useful.
As it says in the settings of IDLE, you can trigger the autocomplete with "Control + Space", e.g. after a "QtGui.". Then a menu opens where you can arrow-scroll through the entries.
using the 'IDLE Editor window', you need to save and execute your code first.
The application running, turn back to the Editor window to use the auto-completion.
In my case, I had to open Options menu -> Extensions tab on the editor and look to make sure AutoComplete and other relevant options were enabled. They actually were, but by just clicking on 'Apply' even though I dint have to change anything did the trick for me.
Sometimes it has to do with the time you have to wait to get a suggestions.
When you go to options > extensions > general at completions popup wait you can change it to about 500ms.
In my case it was 2000ms by default.