Accessing installed non-python files in cli program? - setuptools

I am trying to package a console program that I've written in python that has some non-python xslt files.
This is what my package directory looks like:
fpds-converter
| debug.log
| MANIFEST.in
| requirements-dev.txt
| requirements.txt
| setup.py
\---converter
| | fpds_conversion.py
| | __init__.py
| \---xlst
| | | normalize-record.xsl
\---scripts
| | __init__.py
| | cli.py
My cli program is a cli program run by fpds; however when I run fpds args ... I get
Traceback (most recent call last):
File "D:\projects\fpds-converter\.venv\Scripts\fpds-script.py", line 11, in <module>
load_entry_point('fpds-converter==1.0.0', 'console_scripts', 'fpds')()
File "d:\projects\fpds-converter\.venv\lib\site-packages\pkg_resources\__init__.py", line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "d:\projects\fpds-converter\.venv\lib\site-packages\pkg_resources\__init__.py", line 2852, in load_entry_point
return ep.load()
File "d:\projects\fpds-converter\.venv\lib\site-packages\pkg_resources\__init__.py", line 2443, in load
return self.resolve()
File "d:\projects\fpds-converter\.venv\lib\site-packages\pkg_resources\__init__.py", line 2449, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "d:\projects\fpds-converter\.venv\lib\site-packages\scripts\cli.py", line 4, in <module>
from converter.fpds_conversion import parse
File "d:\projects\fpds-converter\.venv\lib\site-packages\converter\fpds_conversion.py", line 9, in <module>
with open("xslt/normalize-record.xsl", 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'xslt/normalize-record.xsl'
Inside my converter\fpds_converions.py
with open("xslt/normalize-record.xsl", 'rb') as f:
transform = et.XSLT(et.fromstring(f.read()))
In .venv\Lib\site-packages\converter\xslt I see my normalize-record.xsl file.
What am I doing wrong?

Related

Python Imports Keep Failing

I recently wrote a package which is on 1.2.9 but when trying to import it using pip install rolimons Python tries to import 1.2.9 which fails and moves on until version 1.1.3 which is the only version that doesn't error out.
Here is the error:
ERROR: Command errored out with exit status 1:
command: /home/runner/rolimonspy-test/venv/bin/python3 /home/runner/rolimonspy-test/venv/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /tmp/tmp89bhulpc
cwd: /tmp/pip-install-baj2a_r_/rolimons_41a3df9c7f414766a57996a21dc8cd26
Complete output (16 lines):
Traceback (most recent call last):
File "/home/runner/rolimonspy-test/venv/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 280, in <module>
main()
File "/home/runner/rolimonspy-test/venv/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/runner/rolimonspy-test/venv/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 133, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
File "/tmp/pip-build-env-029qi198/overlay/lib/python3.8/site-packages/poetry/core/masonry/api.py", line 41, in prepare_metadata_for_build_wheel
builder = WheelBuilder(poetry)
File "/tmp/pip-build-env-029qi198/overlay/lib/python3.8/site-packages/poetry/core/masonry/builders/wheel.py", line 56, in __init__
super().__init__(poetry, executable=executable)
File "/tmp/pip-build-env-029qi198/overlay/lib/python3.8/site-packages/poetry/core/masonry/builders/builder.py", line 83, in __init__
self._module = Module(
File "/tmp/pip-build-env-029qi198/overlay/lib/python3.8/site-packages/poetry/core/masonry/utils/module.py", line 69, in __init__
raise ModuleOrPackageNotFound(
poetry.core.masonry.utils.module.ModuleOrPackageNotFound: No file/folder found for package python-template
More information about the structure and package here:

Not able to run self-hosted sentry on CentOS

I am trying to install self-hosted sentry on CentOS (CentOS Linux release 7.9.2009 (Core)) according to this documentation - https://develop.sentry.dev/self-hosted/.
But when I run sudo ./install.sh I get this error:
Failed to connect to clickhouse:9000
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/clickhouse_driver/connection.py", line 260, in connect
return self._init_connection(host, port)
File "/usr/local/lib/python3.8/site-packages/clickhouse_driver/connection.py", line 226, in _init_connection
self.socket = self._create_socket(host, port)
File "/usr/local/lib/python3.8/site-packages/clickhouse_driver/connection.py", line 202, in _create_socket
for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
File "/usr/local/lib/python3.8/socket.py", line 918, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known
Connection to Clickhouse cluster clickhouse:9000 failed (attempt 9)
Traceback (most recent call last):
File "/usr/src/snuba/snuba/clickhouse/native.py", line 81, in execute
result: Sequence[Any] = conn.execute(
File "/usr/local/lib/python3.8/site-packages/clickhouse_driver/client.py", line 205, in execute
self.connection.force_connect()
File "/usr/local/lib/python3.8/site-packages/clickhouse_driver/connection.py", line 180, in force_connect
self.connect()
File "/usr/local/lib/python3.8/site-packages/clickhouse_driver/connection.py", line 279, in connect
raise err
clickhouse_driver.errors.NetworkError: Code: 210. Name or service not known (clickhouse:9000)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/snuba/snuba/migrations/connect.py", line 30, in check_clickhouse_connections
check_clickhouse(clickhouse)
File "/usr/src/snuba/snuba/migrations/connect.py", line 49, in check_clickhouse
ver = clickhouse.execute("SELECT version()")[0][0]
File "/usr/src/snuba/snuba/clickhouse/native.py", line 96, in execute
raise ClickhouseError(e.code, e.message) from e
snuba.clickhouse.errors.ClickhouseError: [210] Name or service not known (clickhouse:9000)
Failed to connect to clickhouse:9000
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/clickhouse_driver/connection.py", line 260, in connect
return self._init_connection(host, port)
File "/usr/local/lib/python3.8/site-packages/clickhouse_driver/connection.py", line 226, in _init_connection
self.socket = self._create_socket(host, port)
File "/usr/local/lib/python3.8/site-packages/clickhouse_driver/connection.py", line 202, in _create_socket
for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
File "/usr/local/lib/python3.8/socket.py", line 918, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known
The error from docker-compose logs clickhouse:
clickhouse_1 | Processing configuration file '/etc/clickhouse-server/config.xml'.
clickhouse_1 | Merging configuration file '/etc/clickhouse-server/config.d/docker_related_config.xml'.
clickhouse_1 | Merging configuration file '/etc/clickhouse-server/config.d/sentry.xml'.
clickhouse_1 | Poco::Exception. Code: 1000, e.code() = 0, e.displayText() = Exception: Failed to merge config with '/etc/clickhouse-server/config.d/sentry.xml': Access to file denied: /etc/clickhouse-server/config.d/sentry.xml, Stack trace (when copying this message, always include the lines below):
clickhouse_1 |
clickhouse_1 | 0. Poco::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) # 0x105351b0 in /usr/bin/clickhouse
clickhouse_1 | 1. ? # 0xdefbd83 in /usr/bin/clickhouse
clickhouse_1 | 2. DB::ConfigProcessor::loadConfig(bool) # 0xdef9e97 in /usr/bin/clickhouse
clickhouse_1 | 3. BaseDaemon::reloadConfiguration() # 0x9157010 in /usr/bin/clickhouse
clickhouse_1 | 4. BaseDaemon::initialize(Poco::Util::Application&) # 0x91597d2 in /usr/bin/clickhouse
clickhouse_1 | 5. DB::Server::initialize(Poco::Util::Application&) # 0x8f96458 in /usr/bin/clickhouse
clickhouse_1 | 6. Poco::Util::Application::run() # 0x10457659 in /usr/bin/clickhouse
clickhouse_1 | 7. DB::Server::run() # 0x8f96045 in /usr/bin/clickhouse
clickhouse_1 | 8. mainEntryClickHouseServer(int, char**) # 0x8f8ce23 in /usr/bin/clickhouse
clickhouse_1 | 9. main # 0x8ee8799 in /usr/bin/clickhouse
clickhouse_1 | 10. __libc_start_main # 0x21b97 in /lib/x86_64-linux-gnu/libc-2.27.so
clickhouse_1 | 11. _start # 0x8ee802e in /usr/bin/clickhouse
clickhouse_1 | (version 20.3.9.70 (official build))
clickhouse_1 | Processing configuration file '/etc/clickhouse-server/config.xml'.
clickhouse_1 | Merging configuration file '/etc/clickhouse-server/config.d/docker_related_config.xml'.
clickhouse_1 | Merging configuration file '/etc/clickhouse-server/config.d/sentry.xml'.
clickhouse_1 | Poco::Exception. Code: 1000, e.code() = 0, e.displayText() = Exception: Failed to merge config with '/etc/clickhouse-server/config.d/sentry.xml': Access to file denied: /etc/clickhouse-server/config.d/sentry.xml, Stack trace (when copying this message, always include the lines below):
There is error - Access to file denied: /etc/clickhouse-server/config.d/sentry.xml at clickhouse logs (similar issue - https://forum.sentry.io/t/click-house-giving-permission-errors/12418). How can I set correct permission for this file?
Fixed it by giving 777 permissions for some folders of sentry installation. I know that it can be not desirable for someone but it is easy and fast solution.
sudo chmod -R 777 ./clickhouse
sudo chmod -R 777 ./relay
sudo chmod -R 777 ./sentry
sudo chmod -R 777 ./postgress

do_compile: oe_runmake failed and do_compile: Function failed: do_compile error while building yocto project

I am new to yocto project and start to build yocto project by the steps provided in below link:
https://www.yoctoproject.org/docs/2.5.1/brief-yoctoprojectqs/brief-yoctoprojectqs.html
I am getting errors when i give $ bitbake core-image-sato command. Detailed screenshots of errors are attached.
error_screenshot1
error_screenshot2
Below are the build logs for your reference.
================ Log Start ==================
lenovo#vvdn:~/bhavin/yocto/poky$ source oe-init-build-env
### Shell environment set up for builds. ###
You can now run 'bitbake <target>'
Common targets are:
core-image-minimal
core-image-sato
meta-toolchain
meta-ide-support
You can also run generated qemu images with a command like 'runqemu qemux86'
lenovo#vvdn:~/bhavin/yocto/poky/build$
lenovo#vvdn:~/bhavin/yocto/poky/build$
lenovo#vvdn:~/bhavin/yocto/poky/build$ bitbake core-image-sato
Loading cache: 100% |###########################################################################################################| Time: 0:00:00
Loaded 1282 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies
Build Configuration:
BB_VERSION = "1.37.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "universal"
TARGET_SYS = "i586-poky-linux"
MACHINE = "qemux86"
DISTRO = "poky"
DISTRO_VERSION = "2.5"
TUNE_FEATURES = "m32 i586"
TARGET_FPU = ""
meta
meta-poky
meta-yocto-bsp = "my-yocto-2.5:da3625c52e1ab8985fba4fc3d133edf92142f182"
Initialising tasks: 100% |######################################################################################################| Time: 0:00:07
Checking sstate mirror object availability: 100% |##############################################################################| Time: 0:20:32
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
ERROR: qemu-native-2.11.1-r0 do_compile: oe_runmake failed
ERROR: qemu-native-2.11.1-r0 do_compile: Function failed: do_compile (log file is located at /home/lenovo/bhavin/yocto/poky/build/tmp/work/x86_64-linux/qemu-native/2.11.1-r0/temp/log.do_compile.7408)
ERROR: Logfile of failure stored in: /home/lenovo/bhavin/yocto/poky/build/tmp/work/x86_64-linux/qemu-native/2.11.1-r0/temp/log.do_compile.7408
Log data follows:
| DEBUG: Executing shell function do_compile
| NOTE: make -j 4 LD=ld AR=ar OBJCOPY=objcopy LDFLAGS=-L/home/lenovo/bhavin/yocto/poky/build/tmp/work/x86_64-linux/qemu-native/2.11.1-r0/recipe-sysroot-native/usr/lib -L/home/lenovo/bhavin/yocto/poky/build/tmp/work/x86_64-linux/qemu-native/2.11.1-r0/recipe-sysroot-native/lib -Wl,-rpath-link,/home/lenovo/bhavin/yocto/poky/build/tmp/work/x86_64-linux/qemu-native/2.11.1-r0/recipe-sysroot-native/usr/lib -Wl,-rpath-link,/home/lenovo/bhavin/yocto/poky/build/tmp/work/x86_64-linux/qemu-native/2.11.1-r0/recipe-sysroot-native/lib -Wl,-rpath,/home/lenovo/bhavin/yocto/poky/build/tmp/work/x86_64-linux/qemu-native/2.11.1-r0/recipe-sysroot-native/usr/lib -Wl,-rpath,/home/lenovo/bhavin/yocto/poky/build/tmp/work/x86_64-linux/qemu-native/2.11.1-r0/recipe-sysroot-native/lib -Wl,-O1 -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=/home/lenovo/bhavin/yocto/poky/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2 -fuse-ld=bfd
| GEN ui/input-keymap-linux-to-qcode.c
| GEN ui/input-keymap-qcode-to-qnum.c
| make[1]: '/home/lenovo/bhavin/yocto/poky/build/tmp/work/x86_64-linux/qemu-native/2.11.1-r0/build/capstone/libcapstone.a' is up to date.
| GEN ui/input-keymap-qnum-to-qcode.c
| Traceback (most recent call last):
| Traceback (most recent call last):
| Traceback (most recent call last):
| File "/home/lenovo/bhavin/yocto/poky/build/tmp/work/x86_64-linux/qemu-native/2.11.1-r0/qemu-2.11.1/ui/keycodemapdb/tools/keymap-gen", line 15, in <module>
| File "/home/lenovo/bhavin/yocto/poky/build/tmp/work/x86_64-linux/qemu-native/2.11.1-r0/qemu-2.11.1/ui/keycodemapdb/tools/keymap-gen", line 15, in <module>
| import csv
| import csv
| File "/usr/local/lib/python2.7/csv.py", line 7, in <module>
| File "/usr/local/lib/python2.7/csv.py", line 7, in <module>
| File "/home/lenovo/bhavin/yocto/poky/build/tmp/work/x86_64-linux/qemu-native/2.11.1-r0/qemu-2.11.1/ui/keycodemapdb/tools/keymap-gen", line 15, in <module>
| import csv
| File "/usr/local/lib/python2.7/csv.py", line 7, in <module>
| from functools import reduce
| from functools import reduce
| File "/usr/local/lib/python2.7/functools.py", line 10, in <module>
| File "/usr/local/lib/python2.7/functools.py", line 10, in <module>
| from functools import reduce
| File "/usr/local/lib/python2.7/functools.py", line 10, in <module>
| from _functools import partial, reduce
| ImportError: No module named _functools
| from _functools import partial, reduce
| from _functools import partial, reduce
| ImportErrorImportError: : No module named _functoolsNo module named _functools
|
| CC ui/vnc-enc-hextile.o
| CC ui/input-keymap.o
| CC ui/vnc-palette.o
| CC ui/vnc-enc-tight.o
| CC ui/vnc-enc-zrle.o
| /home/lenovo/bhavin/yocto/poky/build/tmp/work/x86_64-linux/qemu-native/2.11.1-r0/qemu-2.11.1/ui/input-keymap.c:8:44: fatal error: ui/input-keymap-linux-to-qcode.c: No such file or directory
| compilation terminated.
| /home/lenovo/bhavin/yocto/poky/build/tmp/work/x86_64-linux/qemu-native/2.11.1-r0/qemu-2.11.1/rules.mak:66: recipe for target 'ui/input-keymap.o' failed
| make: *** [ui/input-keymap.o] Error 1
| make: *** Waiting for unfinished jobs....
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_compile (log file is located at /home/lenovo/bhavin/yocto/poky/build/tmp/work/x86_64-linux/qemu-native/2.11.1-r0/temp/log.do_compile.7408)
ERROR: Task (virtual:native:/home/lenovo/bhavin/yocto/poky/meta/recipes-devtools/qemu/qemu_2.11.1.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 830 tasks of which 817 didn't need to be rerun and 1 failed.
Summary: 1 task failed:
virtual:native:/home/lenovo/bhavin/yocto/poky/meta/recipes-devtools/qemu/qemu_2.11.1.bb:do_compile
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
lenovo#vvdn:~/bhavin/yocto/poky/build$
lenovo#vvdn:~/bhavin/yocto/poky/build$
================ Log End ==================
Can anyone help me to solve these errors.Any help in this will be appreciated.
Thanks and Regards,
Bhavin Maru
Looks like qemu did not get all its required modules.
Could you please try
bitbake qemu -c cleanall; bitbake qemu -f
Try its make any difference.

PyPDF2.PdfFileReader hangs indefinitely

I'm trying to read this pdf file (https://www.accessdata.fda.gov/cdrh_docs/pdf14/K141693.pdf) and am following these suggestions from SO
Opening pdf urls with pyPdf
I have actually downloaded the file locally and am running the following code
import PyPDF2
pdf_file = open("K141693.pdf")
pdf_read = PyPDF2.PdfFileReader(pdf_file)
but my code hangs indefinitely. I'm running Python 2.7 and here is the stacktrace.
Traceback (most recent call last):
File "", line 1, in
runfile('C:/PoC/pdf_reader.py', wdir='C:/PoC')
File
"C:\ProgramData\Anaconda2\lib\site-packages\spyder\utils\site\sitecustomize.py",
line 880, in runfile
execfile(filename, namespace)
File
"C:\ProgramData\Anaconda2\lib\site-packages\spyder\utils\site\sitecustomize.py",
line 87, in execfile
exec(compile(scripttext, filename, 'exec'), glob, loc)
File "C:/PoC/pdf_reader.py", line 13, in
pdf_read = PyPDF2.PdfFileReader(pdf_file)
File "C:\ProgramData\Anaconda2\lib\site-packages\PyPDF2\pdf.py",
line 1084, in init
self.read(stream)
File "C:\ProgramData\Anaconda2\lib\site-packages\PyPDF2\pdf.py",
line 1697, in read
line = self.readNextEndLine(stream)
File "C:\ProgramData\Anaconda2\lib\site-packages\PyPDF2\pdf.py",
line 1938, in readNextEndLine
x = stream.read(1)
KeyboardInterrupt
I came across another post here PyPDF2 hangs on processing but that too doesn't have a response.
You need to parse the file in binary ('rb') mode. (This works in Python 3:)
import PyPDF2
pdf_file = open("K141693.pdf", "rb")
read_pdf = PyPDF2.PdfFileReader(pdf_file)

PyDev in Debug mode: NameError: dict_pop when importing pandas or xarray

I'm running code to read data from a NetCDF file from a URL with xarray. When I run this code in Eclipse/PyDev in debug mode I am seeing errors that don't happen when launching as a normal Python run or from the command line or as cells of a Jupyter notebook.
I get the following error when I include an import xarray in my code:
NameError: name 'dict_pop' is not defined
Full stack trace looks like this:
pydev debugger: starting (pid: 4004)
URL: https://www.ncei.noaa.gov/data/nclimgrid/nclimgrid_prcp.nc
Traceback (most recent call last):
File "_pydevd_bundle\pydevd_cython_win32_35_64.pyx", line 741, in _pydevd_bundle.pydevd_cython_win32_35_64.PyDBFrame.trace_dispatch (_pydevd_bundle/pydevd_cython_win32_35_64.c:15515)
File "_pydevd_bundle\pydevd_cython_win32_35_64.pyx", line 254, in _pydevd_bundle.pydevd_cython_win32_35_64.PyDBFrame.do_wait_suspend (_pydevd_bundle/pydevd_cython_win32_35_64.c:5631)
File "C:\User Programs\eclipse\neon\plugins\org.python.pydev_5.9.0.201708101613\pysrc\pydevd.py", line 764, in do_wait_suspend
self._activate_mpl_if_needed()
File "C:\User Programs\eclipse\neon\plugins\org.python.pydev_5.9.0.201708101613\pysrc\pydevd.py", line 415, in _activate_mpl_if_needed
activate_function = dict_pop(self.mpl_modules_for_patching, module)
NameError: name 'dict_pop' is not defined
2017-08-16 15:25:06 ERROR Failed to complete ERROR
Traceback (most recent call last):
File "C:\home\git\indices_github\process_xarray.py", line 27, in <module>
ncdata = url.read()
File "C:\home\git\indices_github\process_xarray.py", line 27, in <module>
ncdata = url.read()
File "_pydevd_bundle\pydevd_cython_win32_35_64.pyx", line 982, in _pydevd_bundle.pydevd_cython_win32_35_64.SafeCallWrapper.__call__ (_pydevd_bundle/pydevd_cython_win32_35_64.c:19346)
File "_pydevd_bundle\pydevd_cython_win32_35_64.pyx", line 498, in _pydevd_bundle.pydevd_cython_win32_35_64.PyDBFrame.trace_dispatch (_pydevd_bundle/pydevd_cython_win32_35_64.c:18639)
File "_pydevd_bundle\pydevd_cython_win32_35_64.pyx", line 750, in _pydevd_bundle.pydevd_cython_win32_35_64.PyDBFrame.trace_dispatch (_pydevd_bundle/pydevd_cython_win32_35_64.c:15669)
File "_pydevd_bundle\pydevd_cython_win32_35_64.pyx", line 741, in _pydevd_bundle.pydevd_cython_win32_35_64.PyDBFrame.trace_dispatch (_pydevd_bundle/pydevd_cython_win32_35_64.c:15515)
File "_pydevd_bundle\pydevd_cython_win32_35_64.pyx", line 254, in _pydevd_bundle.pydevd_cython_win32_35_64.PyDBFrame.do_wait_suspend (_pydevd_bundle/pydevd_cython_win32_35_64.c:5631)
File "C:\User Programs\eclipse\neon\plugins\org.python.pydev_5.9.0.201708101613\pysrc\pydevd.py", line 764, in do_wait_suspend
self._activate_mpl_if_needed()
File "C:\User Programs\eclipse\neon\plugins\org.python.pydev_5.9.0.201708101613\pysrc\pydevd.py", line 415, in _activate_mpl_if_needed
activate_function = dict_pop(self.mpl_modules_for_patching, module)
NameError: name 'dict_pop' is not defined
Traceback (most recent call last):
File "C:\User Programs\eclipse\neon\plugins\org.python.pydev_5.9.0.201708101613\pysrc\pydevd.py", line 1621, in <module>
main()
File "C:\User Programs\eclipse\neon\plugins\org.python.pydev_5.9.0.201708101613\pysrc\pydevd.py", line 1615, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "C:\User Programs\eclipse\neon\plugins\org.python.pydev_5.9.0.201708101613\pysrc\pydevd.py", line 1022, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "C:\User Programs\eclipse\neon\plugins\org.python.pydev_5.9.0.201708101613\pysrc\_pydev_imps\_pydev_execfile.py", line 25, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:\home\git\indices_github\process_xarray.py", line 27, in <module>
ncdata = url.read()
File "C:\home\git\indices_github\process_xarray.py", line 27, in <module>
ncdata = url.read()
File "_pydevd_bundle\pydevd_cython_win32_35_64.pyx", line 982, in _pydevd_bundle.pydevd_cython_win32_35_64.SafeCallWrapper.__call__ (_pydevd_bundle/pydevd_cython_win32_35_64.c:19346)
File "_pydevd_bundle\pydevd_cython_win32_35_64.pyx", line 498, in _pydevd_bundle.pydevd_cython_win32_35_64.PyDBFrame.trace_dispatch (_pydevd_bundle/pydevd_cython_win32_35_64.c:18639)
File "_pydevd_bundle\pydevd_cython_win32_35_64.pyx", line 750, in _pydevd_bundle.pydevd_cython_win32_35_64.PyDBFrame.trace_dispatch (_pydevd_bundle/pydevd_cython_win32_35_64.c:15669)
File "_pydevd_bundle\pydevd_cython_win32_35_64.pyx", line 741, in _pydevd_bundle.pydevd_cython_win32_35_64.PyDBFrame.trace_dispatch (_pydevd_bundle/pydevd_cython_win32_35_64.c:15515)
File "_pydevd_bundle\pydevd_cython_win32_35_64.pyx", line 254, in _pydevd_bundle.pydevd_cython_win32_35_64.PyDBFrame.do_wait_suspend (_pydevd_bundle/pydevd_cython_win32_35_64.c:5631)
File "C:\User Programs\eclipse\neon\plugins\org.python.pydev_5.9.0.201708101613\pysrc\pydevd.py", line 764, in do_wait_suspend
self._activate_mpl_if_needed()
File "C:\User Programs\eclipse\neon\plugins\org.python.pydev_5.9.0.201708101613\pysrc\pydevd.py", line 415, in _activate_mpl_if_needed
activate_function = dict_pop(self.mpl_modules_for_patching, module)
NameError: name 'dict_pop' is not defined
I'm using recent/latest versions of xarray and pandas installed on Python 3.5.3 (Anaconda).
I get the same error with an 'import pandas' statement as well, so this may be pandas related instead since xarray depends upon pandas internally.
The packages are installed in Anaconda as shown below:
$ conda list pandas
# packages in environment at C:\home\Anaconda3:
#
pandas 0.20.3 py35_1 conda-forge
$ conda list xarray
# packages in environment at C:\home\Anaconda3:
#
xarray 0.9.6 py35_0 conda-forge
Again I can run this code with the imports of pandas and xarray with no issue from the command line and/or within a Jupyter notebook, this only happens when I launch the code in Eclipse/PyDev in debug mode (regular Python run works as expected).
Example Python code I'm using to test this:
import sys
import xarray as xr
if __name__ == '__main__':
try:
# get the command line arguments
input_netcdf_url = sys.argv[1]
ds = xr.open_dataset(input_netcdf_url)
except:
raise
What can I try next?
Upgrade to 5.9.2... this was one of the critical issues fixed witch prompted the new release.