I pushed code from a local branch (call it "abc") to a remote repo.
I downloaded the code from the repo (under a folder called "xyz") and put it under the same folder that my local branch "abc" is under.
When I run the code from "xyz", the code works.
When I run the code from the local branch "abc", I get an import error.
I have confirmed that my local branch is up to date with the main branch.
Any clue on why this may be occurring?
I don't understand why I would get an import error, especially since both folders (ie, abc and xyz) are under the same folder and I am running both from the same python terminal.
Import error message below:
Traceback (most recent call last):
File "./startActiveLearningWithRationales.py", line 1985, in <module>
=load_dataset(args.dataset, args.validationSet, args.includeRationalesDuringAL, args.includeAllRationalesAtOnce, args.rationalesToIncorporate, args.statisticsToPrint)
File "./startActiveLearningWithRationales.py", line 38, in load_dataset
original_dataset = pickle.load(open(dataFileName, 'rb'))
File "C:\Users\xxx\Anaconda2\lib\pickle.py", line 1384, in load
return Unpickler(file).load()
File "C:\Users\xxx\Anaconda2\lib\pickle.py", line 864, in load
dispatch[key](self)
File "C:\Users\xxx\Anaconda2\lib\pickle.py", line 1096, in load_global
klass = self.find_class(module, name)
File "C:\Users\xxx\Anaconda2\lib\pickle.py", line 1130, in find_class
__import__(module)
ImportError: No module named multiarray
After some debugging, found that the issue has to do with the actual data file itself that is being opened by the call: pickle.load(open(dataFileName, 'rb')). Note that dataFileName = "xxx.dat"
Seems like there is a formatting change between the "xxx.dat" on my local branch and the "xxx.dat" that I download from the remote repo. Is this possible and if so, why?
Format change? Git may have changed the line-endings (eg CR vs LF vs CRLF vs LFCR). Whether that matters to the un-pickling process, I don't know.
By default, Git tries to use the appropriate form for whatever platform you are running git clone
on.
There are ways to change that: you could try git config core.autocrlf input
.
See https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#Formatting-and-Whitespace
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.