How to get the backslash symbol to show up? - python

I keep on getting a yen symbol whenever I press the backslash key. Is there a way to change this? I'm using python by the way.

I had this same problem, but i changed the font in Python IDLE away from the default Meiryo and it fixed it. In IDLE go to Options > Configure IDLE, then in the 'Fonts/Tabs' tab, change the font face to something like Arial. This worked for me.

I know it has been over a year since this question has been asked. I was in your position and kind of ignored the problem, but I finally reached a solution that fixes it. It has to do with certain programs (including cmd.exe) using UNICODE. I was working with java and this problem was heeding progress in what I was doing.
This solution works in Windows 10, the method most likely exists for older versions such as 7 or 8 or 8.1
1) Go to language settings in Control Panel
2) Go to the 'Change date, time, or number formats' link on the left.
3) Go to the administrative tab
4) In the section for 'Language for non-Unicode programs,' it was set to Japanese for me. Since I live in Canada, I appropriately selected English (Canada)
5) Reboot your computer
6) To test this: open cmd.exe and look at the directory present. It should no longer be yen symbols, now backslashes.

Related

Change the tab stop (\t) size in Spyder's IPython Console

For some, it appears that the tab stop size in the IPython Console stop is 4 and not the usual 8.
How do I change it back? I am guessing it has to do with a configuration in Spyder. I looked nearly in all the Preferences options. I could not find a potential solution.
Screenshot
Didn't find a way to change that, but have a look at str.expandtabs?
(Spyder maintainer here) That was removed some months ago because it interfered with code that expected tabs to be tabs (instead of being converted to 8 spaces).
Unfortunately, there's no option to get back the previous behavior either, sorry.

How do I configure Python IDLE's text font?

I've searched all over and can't seem to find a solution. Python's IDLE just looks terrible on my laptop (Lenovo Yoga 2 Pro) with a 3200x1800 display running 8.1
I've attached a screenshot so you can see what I'm talking about. Has anyone figured out how to configure this? Thanks for the help!
Add a file like %USERPROFILE%\.idlerc\config-main.cfg
Add the following lines:
[EditorWindow]
font-size = 14
font = monaco
Or pick your favorite font and size.
I presume 'terrible looking' applies to the old Courier (typewriter) font. IDLE's tk Text windows (Shell, Editor, and Output) default to using 10 point 'TkFixedFont'. On Windows, (and only on Windows), that resolves to 'Courier'. I believe that this is or at least used to be standard on Windows.
The best solution is to select Options on the top menu bar and then Configure IDLE. One is then presented with a dialog with the Fonts/Tabs tab selected and the current font selected in the Base Editor Font box and the current size next to Size. There is an example box showing some text in the current font and size. Change either the font or size and the example is updated. Select OK or Apply and current text windows are updated.
Choices other than default are written to config-main.cfg in directory %USERPROFILE%/.idlerc/. The directory and file are created if necessary.
I personally use the fixed-pitch Lucida Console. I occasionally use variable-pitch Lucida Sans Unicode when using strings with non-Latin characters. One can tell from the example in the box whether a font is fixed or variable in character width by whether characters line up neatly in columns or not. (One of my goals is to add examples from several other scripts so one can also see the unicode coverage offered by a font.)

How to copy text from IDLE?

Is there a way to copy text out of Python IDLE on a Mac? When I highlight text and copy then past into a text editor, I get the same text pasted. It is some of the first text I start with in IDLE. None of the other text will copy out.
From The Things I Hate About IDLE That I Wish Someone Would Fix (from 2011):
1.2) NEW FEATURE: Auto-Copy-On-Highlight
Once we get rid of being able to move the cursor off the last line, that opens a new opportunity to implement an automatic copy-on-highlight feature that many terminal and IRC client programs implement. Since this text is read-only, the only reason a person has for highlighting it is to copy it (they can’t delete it.) As soon as the user highlights text in the shell window, it is copied to the clipboard.
Looks like the best you can do is save as a .py file. Open that in a text editor and continue working in IDLE. With each save, the text editor will refresh with all updates, including errors. At least TextWrangler will.
Sometimes in things like a linux terminal you can't do a normal copy and paste, try holding Command/Control + Shift + C after highlighting things and seeing if that works, since you're on mac i'm not sure if it would be the Command or Control key so try both
EDIT: There is an apple discussion about the exact same thing. They discuss going into the options menu, then into configuration and navigating to the keys section. Then you use a built in key-set, their suggestion is using IDLE Classic Mac.
I cannot tell from your description exactly what you did and what happened. But I can recommend that you upgrade to 3.4.4 or 3.5.1 (or 2.7.11 for 2.7 users). Among other improvements, they all contain a patch to make right-click for context menu work on Mac Aqua. This was issue 24801 on the CPython bug tracker.
If there is still an actual problem on Mac, I would like to know so it can be fixed.

Aquamacs (on Mac lion): whatever I write i being interpreted as "Enter"

I am editing a python script that I wrote a while ago, using aquamacs on Mac lion.
Whichever letter or number I type is being interpreted as "enter" (that is, I hit "g" for example, my text is dissrupted and a newline appears, but "g" does not appear). Restarting aquamacs, the terminal out of which I run it, or the whole computer did not help.
Other observations (that might or might not be connected):
- The script is located in a folder under Dropbox
- The file has special attributes (that is an "#" appears at the end of the permissions, upon typing ls -lah)
- I might have hit a combination of Control, Apple and other keys that I should not have ....
Any solution to this would be very much appreciated (and my apologies, if that has been treated before).
Thanks!
I also met with this problem recently.
You need to add minor mode Fill. Press on the Python in the mode line in mouse-3 way and choose Auto Fill.

Using the emacs bindings in pycharm in OS X Lion

I am trying to use the emacs keybindings in Pycharm 1.5 in OS X 10.7. They all work except that ALT+B inserts a beta symbol rather than moving back a word. It's puzzling since ALT+F does correctly move forward a word.
Also, I was wondering if Pycharm has support for moving between matching parentheses or brackets, like Control-Meta-F in emacs. I didn't see an option for this in the Pycharm keybindings preference pane.
Thanks!
I found a solution on the JetBrains forum. The forum post includes a keymap as an attachment that globally disables the alt keys from generating symbols.
Quoting the forum,
"So, after some digging around, I figured that this option key maps to these relatively unused symbols that are take precedence in the operating system. Using http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=ukelele (Ukelele), I was able to generate an optimized Emacs keyboard layout. You should take this and put it in your /Library/Keyboard Layouts/ folder.
Reboot, and switch to use this keyboard layout on the Mac OSX toolbar and the option key will be free for hotkeying in PyCharm. I'll write up a blog post about this later.
Hope this helps."
esc-ctrl-b works for me, but alt-b doesn't. It's right there in the emacs keymap, so it's strange at first, but I think the problem is that alt-b is mapped to a character (∫ rather than ß in my case) so PyCharm doesn't see it as a key-modifier pair, just a single character.
Switching to a different international keyboard map will change which combinations work and which don't. I'd suggest sending a bug report to PyCharm as it's something they can fix, or alternatively you'll have to hack your keyboard mapping somehow.
To answer your other question, I don't think that there's a way to go to matching parenthesis, or at least I've never found one.

Categories