Tag Archives: An error

Python reported error: typeerror:’int’object is not subscriptable

Check the error line, the error is generally in the integer subscript:
Such as:

a = 4
c=a[2]

Error: line 2, in < module>
c = a [2]
TypeError: ‘int’ object is not subscriptable
Take the more complicated one: two dimensions
 

a = [1,2,3,4]
c=a[2][2]

It’s a one-dimensional array, but it takes an array index, and then it adds a index, same problem.

Java was started but returned exit code = 13

Java was started but returned exit code=13
As is shown in

The reason is that when you update the JRE through a third party, the third party installs a 32-bit JRE that doesn’t match the 64-bit Eclipse. (The error message — Launcher. Library has x86_64 to show that eclipse is 64-bit.)
After installation JDK8/JRE8 adds an environment variable C:\ProgramData\Oracle\Java\ Javapath
The environment variable is three shortcuts, java.exe.lnk javaw.exe.lnk javaws.exe.lnk. Every time you install the JDK/JRE, these three shortcuts will update the path to the last JRE path

Cause found, reinstall the 64-bit JDK to fix the problem
Attached is a comparison of the 1:32 bit 64-bit running java-Version commands
32 bit

C:\>java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) Client VM (build 25.60-b23, mixed mode)

A 64 – bit

C:\>java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

you can see that 64 is 64 Bit, 32 Bit is not
Annex 2: Determine whether Eclipse is 32-bit or 64-bit through eclipse directory specific files
The directory structure of eclipse32-bit and 64-bit is similar. We can look at the Eclipse.ini file after unziping and compare it with -launcher. Library to find if there is x86_64
As shown in the figure, the top is 32 bits and the bottom is 64 bits

Eclipse directory structure

locale.Error : the solution of unsupported locale setting

locale.Error: unsupported locale setting locale


Error: the solution set by unsupported locale
0. References 1. Cause of error 2. Solution


0. References
https://stackoverflow.com/questions/14547631/python-locale-error-unsupported-locale-setting


1. Report the cause of the error
The ubuntu 16.04 installed on the vagrant + virtualbox installed on the ubuntu 16.04 used the pip3 list and the python3-m venv venv both commands gave the error message as follows:

vagrant@ubuntu-xenial:~/microblog$ pip3 list
Traceback (most recent call last):
  File "/usr/bin/pip3", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python3/dist-packages/pip/__init__.py", line 215, in main
    locale.setlocale(locale.LC_ALL, '')
  File "/usr/lib/python3.5/locale.py", line 594, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

The reason is that the system lacks the corresponding language package, which needs to be downloaded and installed.


2. Solutions
Use the locale locale to view the current language Settings:

vagrant@ubuntu-xenial:~$ locale
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=zh_CN.UTF-8
LC_TIME=zh_CN.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=zh_CN.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=zh_CN.UTF-8
LC_NAME=zh_CN.UTF-8
LC_ADDRESS=zh_CN.UTF-8
LC_TELEPHONE=zh_CN.UTF-8
LC_MEASUREMENT=zh_CN.UTF-8
LC_IDENTIFICATION=zh_CN.UTF-8
LC_ALL=

It is found that there are two languages in this setting, one is en_us.utf-8 , and the other is zh_cn.utf-8 .
Use locale -a to view all available languages in the current system:

vagrant@ubuntu-xenial:~$ locale -a
C
C.UTF-8
en_US.utf8
id_ID.utf8
POSIX

It was found that zh_cn.utf-8 is missing in the available language above, and this is the reason for the error.
Use sudo apt install language-pack-zh-hans installation language:

vagrant@ubuntu-xenial:~$ sudo apt install language-pack-zh-hans
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  language-pack-zh-hans-base
The following NEW packages will be installed:
  language-pack-zh-hans language-pack-zh-hans-base
0 upgraded, 2 newly installed, 0 to remove and 3 not upgraded.
Need to get 2110 kB of archives.
After this operation, 8545 kB of additional disk space will be used.
Do you want to continue?[Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 language-pack-zh-hans-base all 1:16.04+20160627 [2108 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 language-pack-zh-hans all 1:16.04+20160627 [1870 B]
Fetched 2110 kB in 3s (567 kB/s)           
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_TIME = "zh_CN.UTF-8",
    LC_MONETARY = "zh_CN.UTF-8",
    LC_ADDRESS = "zh_CN.UTF-8",
    LC_TELEPHONE = "zh_CN.UTF-8",
    LC_NAME = "zh_CN.UTF-8",
    LC_MEASUREMENT = "zh_CN.UTF-8",
    LC_IDENTIFICATION = "zh_CN.UTF-8",
    LC_NUMERIC = "zh_CN.UTF-8",
    LC_PAPER = "zh_CN.UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
locale: Cannot set LC_ALL to default locale: No such file or directory
Selecting previously unselected package language-pack-zh-hans-base.
(Reading database ... 89747 files and directories currently installed.)
Preparing to unpack .../language-pack-zh-hans-base_1%3a16.04+20160627_all.deb ...
Unpacking language-pack-zh-hans-base (1:16.04+20160627) ...
Selecting previously unselected package language-pack-zh-hans.
Preparing to unpack .../language-pack-zh-hans_1%3a16.04+20160627_all.deb ...
Unpacking language-pack-zh-hans (1:16.04+20160627) ...
Setting up language-pack-zh-hans (1:16.04+20160627) ...
Setting up language-pack-zh-hans-base (1:16.04+20160627) ...
Generating locales (this might take a while)...
  zh_CN.UTF-8... done
  zh_SG.UTF-8... done
Generation complete.

Finally, we generated the zh_cn.utf-8 language that we needed.
Using pip3 list and python3-m venv venv again will not give an error.

“There was an internal API error” in Xcode debugging;

Visit: here
I wrote a game demo a while ago. I took some time to optimize the following method today. I found that the following errors will be reported when Debugging on iPad.

At the beginning, I thought that I used a private API. Later, I carefully checked that there was no problem. Therefore, I began to use the common debugging method when the real machine debugging went wrong.
1. Necessary good habits, Product –& GT; The clear;
2. Delete the previously debugged program on iPad, run it again, OK, and solve the problem (unexpectedly easy); As for the specific reason, I found that when the error dialog box popped up, it happened to be the detection of certificates such as profile, which might have something to do with the identification detection of the real machine. No matter how much, the problem is solved;
3. I encountered this problem again today. It was found that the apps debugged on the real computer had a profile conflict with some apps on the iPad, that is, they Shared a profile. (added on 14 May 2013)
PS: today may no longer regrets about baidu and Google, don’t know if industry reason, sometimes some problem on the search technology, found that all these results given in baidu and Google really really can’t, the efficiency is too low, turn a few pages is less than what you want, don’t know the reason why is because the algorithm or because baidu too pursuit of commercial cause, so if you have any questions how sometimes asked baidu are not the answer, might as well try Google;

Error: You have not concluded your merge (MERGE_HEAD exists)

Difference between Git fetch and Git pull: Error: You have not concluded your merge (MERGE_HEAD exists)

The difference between FETCH and pull is that you can fetch the latest version from remote to local
1. Fetch: only fetch the latest version from remote to local, not merge(merge)

git fetch origin master   //Get the latest version on the origin/master branch from the master master branch on a remote origin.
git log -p master..origin/master //Compare the difference between a local master branch and an origin/master branch.
git merge origin/master          //consolidation

2. Pull: get the latest version remotely and merge(merge) locally

git pull origin master  //This is equivalent to doing a git fetch and a git merge.

In practice, it may be better to git fetch, because before merge, it can be decided whether to merge according to the actual situation
Besides, it causes error: error: You have not concluded your merge (MERGE_HEAD exists). may be caused by the failure of automatically merging the code pulled down before
Solution 1: keep the local changes and abort the merge -& GT; Re-amalgamate -& GT; To pull

git merge --abort //Termination of pooling
git reset --merge //re-merger
git pull //refetch

Solution 2: Abandon the local code, and the remote version overwrites the local version (careful)

git fetch --all
git reset --hard origin/master
git fetch