The error is the following:
Traceback (most recent call last):
File "C:\Users\Shubham\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 3208, in main
mainwindow = run_spyder(app, options, args)
File "C:\Users\Shubham\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 3084, in run_spyder
main.setup()
File "C:\Users\Shubham\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 828, in setup
self.workingdirectory = WorkingDirectory(self, self.init_workdir, main=self)
File "C:\Users\Shubham\Anaconda3\lib\site-packages\spyder\plugins\workingdirectory.py", line 159, in __init__
self.chdir(workdir)
File "C:\Users\Shubham\Anaconda3\lib\site-packages\spyder\plugins\workingdirectory.py", line 296, in chdir
self.refresh_plugin()
File "C:\Users\Shubham\Anaconda3\lib\site-packages\spyder\plugins\workingdirectory.py", line 204, in refresh_plugin
self.save_wdhistory()
File "C:\Users\Shubham\Anaconda3\lib\site-packages\spyder\plugins\workingdirectory.py", line 234, in save_wdhistory
encoding.writelines(text, self.LOG_PATH)
File "C:\Users\Shubham\Anaconda3\lib\site-packages\spyder\utils\encoding.py", line 236, in writelines
return write(os.linesep.join(lines), filename, encoding, mode)
File "C:\Users\Shubham\Anaconda3\lib\site-packages\spyder\utils\encoding.py", line 227, in write
with open(filename, mode) as textfile:
FileNotFoundError: [Errno 2] No such file or directory: '%USERPROFILE\\.spyder-py3\\workingdir'
(Spyder maintainer here) This is a bug in Spyder and we'll fix it in our 3.3.0 version, to be released later in June/2018.
Related
My computer shut down while running a simple code on Spyder. Ever since it has restarted, it seems that /Users/fp/.ipython has not been found anymore.
To be more specific, I run:
ipython3
And I get the following error message:
Traceback (most recent call last):
File "/Users/fp/opt/anaconda3/lib/python3.9/site-packages/traitlets/traitlets.py", line 537, in get
value = obj._trait_values[self.name]
KeyError: 'ipython_dir'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/fp/opt/anaconda3/bin/ipython3", line 11, in <module>
sys.exit(start_ipython())
File "/Users/fp/opt/anaconda3/lib/python3.9/site-packages/IPython/__init__.py", line 130, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
File "/Users/fp/opt/anaconda3/lib/python3.9/site-packages/traitlets/config/application.py", line 845, in launch_instance
app.initialize(argv)
File "/Users/fp/opt/anaconda3/lib/python3.9/site-packages/traitlets/config/application.py", line 88, in inner
return method(app, *args, **kwargs)
File "/Users/fp/opt/anaconda3/lib/python3.9/site-packages/IPython/terminal/ipapp.py", line 308, in initialize
super(TerminalIPythonApp, self).initialize(argv)
File "/Users/fp/opt/anaconda3/lib/python3.9/site-packages/traitlets/config/application.py", line 88, in inner
return method(app, *args, **kwargs)
File "/Users/fp/opt/anaconda3/lib/python3.9/site-packages/IPython/core/application.py", line 458, in initialize
self.init_profile_dir()
File "/Users/fp/opt/anaconda3/lib/python3.9/site-packages/IPython/core/application.py", line 362, in init_profile_dir
p = ProfileDir.find_profile_dir_by_name(self.ipython_dir, self.profile, self.config)
File "/Users/fp/opt/anaconda3/lib/python3.9/site-packages/traitlets/traitlets.py", line 577, in __get__
return self.get(obj, cls)
File "/Users/fp/opt/anaconda3/lib/python3.9/site-packages/traitlets/traitlets.py", line 540, in get
default = obj.trait_defaults(self.name)
File "/Users/fp/opt/anaconda3/lib/python3.9/site-packages/traitlets/traitlets.py", line 1580, in trait_defaults
return self._get_trait_default_generator(names[0])(self)
File "/Users/fp/opt/anaconda3/lib/python3.9/site-packages/traitlets/traitlets.py", line 977, in __call__
return self.func(*args, **kwargs)
File "/Users/fp/opt/anaconda3/lib/python3.9/site-packages/IPython/core/application.py", line 174, in _ipython_dir_default
d = get_ipython_dir()
File "/Users/fp/opt/anaconda3/lib/python3.9/site-packages/IPython/paths.py", line 70, in get_ipython_dir
os.makedirs(ipdir, exist_ok=True)
File "/Users/fp/opt/anaconda3/lib/python3.9/os.py", line 225, in makedirs
mkdir(name, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/fp/.ipython'
I checked and indeed I do not have a /Users/fp/.ipython folder. On the contrary, I still have a /Users/fp/.jupyter folder for example.
ipython3 --version
7.31.1
conda --version
conda 22.9.0
python3 --version
Python 3.9.13
Anyone could help me with that?
Thank you
Error : ERROR: Exception: Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/pip/_internal/cli/base_command.py", line 189, in _main status = self.run(options, args) File "/usr/local/lib/python3.6/dist-packages/pip/_internal/cli/req_command.py", line 178, in wrapper return func(self, options, args) File "/usr/local/lib/python3.6/dist-packages/pip/_internal/commands/install.py", line 400, in run pycompile=options.compile, File "/usr/local/lib/python3.6/dist-packages/pip/_internal/req/init.py", line 88, in install_given_reqs pycompile=pycompile, File "/usr/local/lib/python3.6/dist-packages/pip/_internal/req/req_install.py", line 796, in install requested=self.user_supplied, File "/usr/local/lib/python3.6/dist-packages/pip/_internal/operations/install/wheel.py", line 827, in install_wheel requested=requested, File "/usr/local/lib/python3.6/dist-packages/pip/_internal/operations/install/wheel.py", line 662, in _install_wheel file.save() File "/usr/local/lib/python3.6/dist-packages/pip/_internal/operations/install/wheel.py", line 427, in save with self._zip_file.open(zipinfo) as f: File "/usr/lib/python3.6/zipfile.py", line 1510, in open raise BadZipFile("Bad magic number for file header") zipfile.BadZipFile: Bad magic number for file header
Downloaded Python wheel tensorflow-2.4.1-cp36-cp36-linux_aarch64.whl from https://github.com/Qengineering/TensorFlow-Raspberry-Pi_64-bit
I was trying to clean up duplicates in an excel file using dedupe.
The code worked fine at first and the code itself is simple. But whenever I run the code I get the below error. The code works fine if I delete all the temp files, restart pycharm or restart my computer and it won't run for the second time.
The data file is a csv file with a list of random similar name in column A with header as 'Name'. Please help tp resolve. Thank you.
Code
import pandas as pd
import pandas_dedupe
#loading data
df = pd.read_csv('duplicate.csv')
#deduplication process
df_final = pandas_dedupe.dedupe_dataframe(df,['Name'])
#save to csv
df_final.to_csv('cleansed_output.csv')
Getting error below
C:\Users\Username\AppData\Roaming\Python\Python38\site-packages\pandas_dedupe\utility_functions.py:17: FutureWarning: The default value of regex will change from True to False in a future version.
df[i] = df[i].str.replace('[^\w\s\.\-\(\)\,\:\/\\\\]','')
Reading from dedupe_dataframe_learned_settings
Clustering...
Traceback (most recent call last):
File "C:\Users\Username\AppData\Roaming\Python\Python38\site-packages\dedupe\api.py", line 103, in score
matches = core.scoreDuplicates(pairs,
File "C:\Users\Username\AppData\Roaming\Python\Python38\site-packages\dedupe\core.py", line 244, in scoreDuplicates
process.start()
File "C:\Users\Username\AppData\Local\Programs\Python\Python38\lib\multiprocessing\process.py", line 121, in start
self._popen = self._Popen(self)
File "C:\Users\Username\AppData\Local\Programs\Python\Python38\lib\multiprocessing\context.py", line 224, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "C:\Users\Username\AppData\Local\Programs\Python\Python38\lib\multiprocessing\context.py", line 327, in _Popen
return Popen(process_obj)
File "C:\Users\Username\AppData\Local\Programs\Python\Python38\lib\multiprocessing\popen_spawn_win32.py", line 45, in __init__
prep_data = spawn.get_preparation_data(process_obj._name)
File "C:\Users\Username\AppData\Local\Programs\Python\Python38\lib\multiprocessing\spawn.py", line 154, in get_preparation_data
_check_not_importing_main()
File "C:\Users\Username\AppData\Local\Programs\Python\Python38\lib\multiprocessing\spawn.py", line 134, in _check_not_importing_main
raise RuntimeError('''
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.
This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:
if __name__ == '__main__':
freeze_support()
...
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an executable.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Username\AppData\Local\Programs\Python\Python38\lib\multiprocessing\spawn.py", line 116, in spawn_main
exitcode = _main(fd, parent_sentinel)
File "C:\Users\Username\AppData\Local\Programs\Python\Python38\lib\multiprocessing\spawn.py", line 125, in _main
prepare(preparation_data)
File "C:\Users\Username\AppData\Local\Programs\Python\Python38\lib\multiprocessing\spawn.py", line 236, in prepare
_fixup_main_from_path(data['init_main_from_path'])
File "C:\Users\Username\AppData\Local\Programs\Python\Python38\lib\multiprocessing\spawn.py", line 287, in _fixup_main_from_path
main_content = runpy.run_path(main_path,
File "C:\Users\Username\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 265, in run_path
return _run_module_code(code, init_globals, run_name,
File "C:\Users\Username\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "C:\Users\Username\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\Username\PycharmProjects\Duplicate\main.py", line 10, in <module>
df_final = pandas_dedupe.dedupe_dataframe(df,['Name'])
File "C:\Users\Username\AppData\Roaming\Python\Python38\site-packages\pandas_dedupe\dedupe_dataframe.py", line 249, in dedupe_dataframe
clustered_df = _cluster(deduper, data_d, threshold, canonicalize)
File "C:\Users\Username\AppData\Roaming\Python\Python38\site-packages\pandas_dedupe\dedupe_dataframe.py", line 143, in _cluster
clustered_dupes = deduper.partition(data, threshold)
File "C:\Users\Username\AppData\Roaming\Python\Python38\site-packages\dedupe\api.py", line 170, in partition
pair_scores = self.score(pairs)
File "C:\Users\Username\AppData\Roaming\Python\Python38\site-packages\dedupe\api.py", line 108, in score
raise RuntimeError('''
RuntimeError:
You need to either turn off multiprocessing or protect
the calls to the Dedupe methods with a
`if __name__ == '__main__'` in your main module, see
https://docs.python.org/3/library/multiprocessing.html#the-spawn-and-forkserver-start-methods
Traceback (most recent call last):
File "C:\Users\Username\AppData\Local\Programs\Python\Python38\lib\shutil.py", line 616, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\USERNAME~1.KAB\\AppData\\Local\\Temp\\tmpp9123_pc\\blocks.db'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Username\AppData\Local\Programs\Python\Python38\lib\tempfile.py", line 802, in onerror
_os.unlink(path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\USERNAME~1.KAB\\AppData\\Local\\Temp\\tmpp9123_pc\\blocks.db'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Username\AppData\Local\Programs\Python\Python38\lib\weakref.py", line 642, in _exitfunc
f()
File "C:\Users\Username\AppData\Local\Programs\Python\Python38\lib\weakref.py", line 566, in __call__
return info.func(*info.args, **(info.kwargs or {}))
File "C:\Users\Username\AppData\Local\Programs\Python\Python38\lib\tempfile.py", line 817, in _cleanup
cls._rmtree(name)
File "C:\Users\Username\AppData\Local\Programs\Python\Python38\lib\tempfile.py", line 813, in _rmtree
_shutil.rmtree(name, onerror=onerror)
File "C:\Users\Username\AppData\Local\Programs\Python\Python38\lib\shutil.py", line 740, in rmtree
return _rmtree_unsafe(path, onerror)
File "C:\Users\Username\AppData\Local\Programs\Python\Python38\lib\shutil.py", line 618, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
File "C:\Users\Username\AppData\Local\Programs\Python\Python38\lib\tempfile.py", line 805, in onerror
cls._rmtree(path)
File "C:\Users\Username\AppData\Local\Programs\Python\Python38\lib\tempfile.py", line 813, in _rmtree
_shutil.rmtree(name, onerror=onerror)
File "C:\Users\Username\AppData\Local\Programs\Python\Python38\lib\shutil.py", line 740, in rmtree
return _rmtree_unsafe(path, onerror)
File "C:\Users\Username\AppData\Local\Programs\Python\Python38\lib\shutil.py", line 599, in _rmtree_unsafe
onerror(os.scandir, path, sys.exc_info())
File "C:\Users\Username\AppData\Local\Programs\Python\Python38\lib\shutil.py", line 596, in _rmtree_unsafe
with os.scandir(path) as scandir_it:
NotADirectoryError: [WinError 267] The directory name is invalid: 'C:\\Users\\USERNAME~1.KAB\\AppData\\Local\\Temp\\tmpp9123_pc\\blocks.db'
Process finished with exit code -1
The answer is in the error:
You need to either turn off multiprocessing or protect the calls to the Dedupe methods with a if __name__ == '__main__' in your main module
Change your code to the following, and try again:
import pandas as pd
import pandas_dedupe
if __name__ == "__main__":
#loading data
df = pd.read_csv('duplicate.csv')
#deduplication process
df_final = pandas_dedupe.dedupe_dataframe(df,['Name'])
#save to csv
df_final.to_csv('cleansed_output.csv')
I have been using the library misty for one month and it's working on my personal laptop. But when I am trying to make it work on the another device it gives an error:
Traceback (most recent call last):
File "client.py", line 577, in <module>
main()
File "client.py", line 558, in main
this_device, args.ini.address,
File "client.py", line 57, in __init__
MSTPSimpleApplication.__init__(self, *args)
File "/###/###/venv/lib/python3.7/python3.7/site-packages/misty/mstplib/__init__.py", line 531, in __init__
self.mux = MSTPMultiplexer(self.localDevice, self.localAddress)
File "/###/###/venv/lib/python3.7/python3.7/site-packages/misty/mstplib/__init__.py", line 428, in __init__
self.directPort = MSTPDirector(self.localDevice, self.address)
File "/###/###/venv/lib/python3.7/python3.7/site-packages/misty/mstplib/__init__.py", line 203, in __init__
mstp_lib = cdll.LoadLibrary(libmstp_path)
File "/usr/lib/python3.7/ctypes/__init__.py", line 442, in LoadLibrary
return self._dlltype(name)
File "/usr/lib/python3.7/ctypes/__init__.py", line 364, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /###/###/venv/lib/python3.7/site-packages/misty/mstplib/libmstp_agent.so: cannot open shared object file: No such file or directory
How can I fix this?
Thanks in anticipation.
I have a relatively straight forward snippet which throws an error:
import shutil
abspath_to_source_file = '/media/moose/VFF1147/MAP_DATA/BACK/B0000040.DFT'
target_dir = '/media/moose/9C33-6BBD/PRIVATE/PANA_GRP/PAVC/LUMIX/MAP_DATA/BACK'
shutil.copy2(abspath_to_source_file, target_dir)
which gives
Traceback (most recent call last):
File "/usr/local/bin/lumixmaptool", line 4, in <module>
__import__('pkg_resources').run_script('lumixmaptool==1.0.15', 'lumixmaptool')
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 735, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1652, in run_script
exec(code, namespace, namespace)
File "/usr/local/lib/python2.7/dist-packages/lumixmaptool-1.0.15-py2.7.egg/EGG-INFO/scripts/lumixmaptool", line 56, in <module>
main(args)
File "/usr/local/lib/python2.7/dist-packages/lumixmaptool-1.0.15-py2.7.egg/EGG-INFO/scripts/lumixmaptool", line 49, in main
copy.main(args.mapdata, args.path_to_sdcard, args.regions)
File "/usr/local/lib/python2.7/dist-packages/lumixmaptool-1.0.15-py2.7.egg/lumixmaptool/copy.py", line 177, in main
copy_maps(mapdata, path_to_sdcard, regions)
File "/usr/local/lib/python2.7/dist-packages/lumixmaptool-1.0.15-py2.7.egg/lumixmaptool/copy.py", line 148, in copy_maps
shutil.copy2(abspath_to_source_file, target_dir)
File "/usr/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/usr/lib/python2.7/shutil.py", line 100, in copystat
os.chmod(dst, mode)
OSError: [Errno 38] Function not implemented: '/media/moose/9C33-6BBD/PRIVATE/PANA_GRP/PAVC/LUMIX/MAP_DATA/BACK/B0000040.DFT'
Is the reason eventually be the file system? (If I remember it correctly, I formatted it as exFAT, but I only get 'fuseblk' when I try df -T or mount. sudo file -Ls /dev/sdb1 gives DOS/MBR boot sector)
1st question: What is the problem?
2nd question: How can I fix it?