Category Archives: How to Fix

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

Jstack command execution error: unable to open socket file: target process not responding or hotspot VM not loaded

An error is reported when the jstack command is executed. The error is as follows

Unable to open socket file: target process not responding or HotSpot VM not loaded
The -F option can be used when the target process is not responding

This process can be viewed through PS command

I found an article about jstack command not configured well on the Internet

Switch to the / tmp directory

cd /tmp

There are several directories at the beginning of hsperfdata. Go to the directory to see if there is a process number executed by jstack

After checking, it is found that the process behind jstack is not executed by the root user, and the switch to another user is successful

Later, we found that PS – aux can also see who executed the process, so we don’t have to be so troublesome

TypeError: ‘numpy.int64′ object is not iterable ,’int’ object is not iterable

If you want to use a list to dynamically add numpy type data, as shown in the following code, you will find that the error type error is: ‘ numpy.int64 ‘ object is not iterable 

a = []
b = np.array([1,2,3])
a.extend(b[0])
a.extend(b[1])
a.extend(b[2])
print(a)

The numpy data is converted to the list type, as follows:

a = []
b = np.array([1,2,3])
a.extend(b[0].tolist())
a.extend(b[1].tolist())
a.extend(b[2].tolist())
print(a)

Error found: typeerror: ‘Int’ object is not Iterable

By printing the type of ‘B [0]. Tolist ()’, we find that the type of ‘B [0]. Tolist ()’ is’ Int ‘, that is, it does not convert’ B [0]. Tolist () ‘to list type

Then modify the code as follows, change ‘B [0]. Tolist ()’ to list type by adding a bracket []

a = []
b = np.array([1,2,3])
a.extend([b[0].tolist()])
a.extend([b[1].tolist()])
a.extend([b[2].tolist()])
print(a) #[1, 2, 3]

————————————————————————-Dividing line————————————————————————————————–

Later, I found that the following code can also be used directly:

a = []
b = np.array([1,2,3])
a.extend([b[0]])
a.extend([b[1]])
a.extend([b[2]])
print(a) #[1, 2, 3]

This is because the ‘B [0]’ is changed from numpy data type to list type by adding a bracket []

Error analysis of receive comments before first target. Stop

Error analysis of receive comments before first target. Stop

Today, make an example of using the make file, install the operation and write the file. This error occurred using ‘make – F makefile1’.

recipe commences before first target.  Stop

The content of makefile1 is also very simple

[tab]3.o: 3.c b.h c.h

[tab][tab]gcc -c 3.c

Later, it was found that the [tab] in the first line needed to be deleted, and the command passed.

3.o: 3.c b.h c.h

[tab][tab]gcc -c 3.c

There is a very regrettable syntax phenomenon in makefile: there is a difference between control and tab. The line of the rule must start with a tab, not a space.