File “manage.py“, line 17 ) from exc ^ SyntaxError: invalid syntax

The newly created Django project will run directly after entering

python manage.py runserver

The mistakes are as follows:

user@UserdeMacBook-Pro djangoProject % python manage.py runserver
  File "manage.py", line 17
    ) from exc
         ^
SyntaxError: invalid syntax

I feel a little puzzled. Later, I found that there was a problem with the specification of the python version. I should specify the python 3 version

python3 manage.py runserver

That’s it.

Python error type error: ‘range’ object does not support item assignment, solution

1. Examples are as follows:

from math import sqrt
if __name__ == '__main__':
    N = 100
    a = range(0,N)
    for i in range(2,int(sqrt(N))):
        for j in range(i + 1,N):
            if (a[i] != 0) and (a[j] != 0):
                if a[j] % a[i] == 0:
                        a[j]= 0

    for i in range(2,N):
        if a[i] != 0:
            print ("%5d" % a[i])
            if (i - 2) % 10 == 0:
                print         

Error after execution: typeerror: ‘range’ object does not support item assignment

2. The reasons for the error are as follows:

Try to use range()
to create an integer list (leading to “typeerror: ‘range’ object does not support item assignment”). Sometimes you want to get an ordered integer list, so range() seems to be a good way to generate this list. However, you need to remember that range () returns the “range object” instead of the actual list value.

3. Solutions:

Just change the code of the above example: a = range (0, n) to a = list (range (0, n))!

Solve the problem of multiple root tags in as

In as, multiple root tags usually appear when a piece of code is copied to another space

In the first case, the root tag of the original code is copied when the code is copied. In the second case, the code is not put into a package in another space to check whether the package in another space covers the new code

data argument can’t be an iterator

 b = map(ct,data.as_matrix())

data = pd.DataFrame(b).fillna(0)
Traceback (most recent call last):

  File "<ipython-input-47-48b397cc2c53>", line 1, in <module>
    data = pd.DataFrame(b).fillna(0)

  File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\frame.py", line 389, in __init__
    raise TypeError("data argument can't be an iterator")

TypeError: data argument can't be an iterator

Reason: Elements in a dataframe cannot be iterative.

b = map(ct,data.as_matrix())
c = list(b)
data = pd.DataFrame(c).fillna(0)

Unicode decodeerror: ‘UTF-8’ codec can’t decode byte 0x80 in position 3131: invalid start byte solution

The Unicode decodeerror: ‘UTF-8’ codec can’t decode byte 0x80 in position 3131: invalid start byte appears in the process of using Python 3 to read files on Mac OS.

The reason is: OS X system has hidden file. DS in the folder_ Store file, affecting the file read.

.DS_ Store is a hidden file that stores the custom properties of a folder on Mac OS, such as its icon location or background color.

The solution is: use the command line to enter the folder where the file is read and delete. DS_ Store file.

1. Use the command LS – A to view. DS_ Store file

2. rm .DS_ Store。

 

pyspark : NameError: name ‘spark’ is not defined

This is because there is no default in Python program pyspark.sql.session . sparksession , so we just need to import the relevant modules and then convert them to sparksession .
Related codes:

from pyspark.context import SparkContext
from pyspark.sql.session import SparkSession
sc = SparkContext('local')
spark = SparkSession(sc)
print(type(spark))

Print out its type and solve it successfully:
& lt; class' pyspark.sql.session .SparkSession'>

Assignment under multiple single edges is not supported for synthesis

Pay attention to check the error prompts, which will generally tell you where to find the reason. Assignment under multiple single edges is not supported

Let’s look at your code. Where is edge related? (posedge sclk or posedge reset)

That’s how we usually use it,

always @ (posedge clk or posedge reset) 

if (reset == 1’b1)

….

else

Reset is the reset signal,

If your code doesn’t have the following reset part, it will think that this is a clock sampling, and multiple clocks will take the same data, so it will report an error.

ImportError: No module named indexes.base

The problem recurred

When I use pickle to reload data, all the errors are as follows:

Traceback (most recent call last):
  File "segment.py", line 17, in <module>
    word2id = pickle.load(pk)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 1378, in load
    return Unpickler(file).load()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 858, in load
    dispatch[key](self)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 1090, in load_global
    klass = self.find_class(module, name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 1124, in find_class
    __import__(module)
ImportError: No module named indexes.base

The reason for this

The same code and data run on two different machines. At first, I thought the wrong machine was missing some Python packages. But there are too many packages to install, so I can’t try them one by one. Fortunately, I use virsualenv to copy the environment from another machine to this machine directly. After running, there is no problem. But in order to find out which Python installation package is missing, I use the original compilation environment, reuse pickle to generate the original data to be loaded, and then reload it At this time, there was no error.

summary

To sum up, the reason is that the original version of panda used in the generation of pickle file is different from the current version of load pickle file. So whether it is to write code in Python or other languages, the compiling environment is very important. Once the version of a package is different, it may also lead to program errors.

Arrow function should not return assignment no-return-assign

Arrow function should not return assignment no return assignment.

This paper describes the problems encountered in learning p221 of the latest Vue and vuejs in 2019, from introduction to mastery. Because the checking code of eslint is referenced, the checking error is reported. There is no problem with the code, it is the problem of eslint checking.
Solutions: 1. Remove eslint
2. Modify the code to conform to eslint
original code

   if (this.isSelectAll) {
        this.cartList.forEach(item => item.checked = false)
      } else {
        this.cartList.forEach(item => item.checked = true)
      }

Changed code

   if (this.isSelectAll) {
        this.cartList.forEach(item => { item.checked = false })
      } else {
        this.cartList.forEach(item => { item.checked = true })
      }

After learning the arrow function, we can know that the {} added can be omitted, but the rule of eslint requires this.

Error: no such keg: / usr / local / cellular / node & install NVM & Brew install & oh my Zsh. Git install & git set alias & no bundle URL press

Problems with new PC configuration environment:

The node cannot be found, but when it is reinstalled, it will be prompted with node: or the node will report an error: no such keg: / usr / local / cellular / node

brew cleanup 

brew link node

brew uninstall node

brew uninstall –force node

brew install node

 

Install NVM command (node version management tool)

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash

Press finish to restart item

 

Install n (node version management tool)

 $ sudo npm install -g n

 

Brew installation command:

/usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install )”

 

 

Oh my Zsh. Git plug in installation command

sh -c “$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh )”

 

 

Git set alias

We just need to type a command and tell git, then st means status:

git config –global alias.s status

git config –global alias.c commit

git config –global alias.ck checkout

git config –global alias.a add

 

 

No bundle URL present

Appdelegate. M modify the generated code

jsCodeLocation = [NSURL URLWithString:@” http://127.0.0.1 :8081/ index.bundle?platform=ios&amp ;dev=false”];

 

New computer error reporting unit test error reporting jest.mock () is not allowed to reference any out-of-scope variables

Node version problem reduced to v8.12.0 or v6.11.3

 

If the node version switch is useless, please use:

NVM alias default v6.11.3 to modify the default node version