import of Data.Path module in Purescript repl failed - purescript

I tried to import in purescript repl the Data.Path module but got following error
Error found:
in module $PSCI
at <internal> line 0, column 0 - line 0, column 0
Unknown module Data.Path
See https://github.com/purescript/documentation/blob/master/errors/UnknownName.md
for more information, or to contribute content related to this error.enter code here
Which packages should I install to be able to issue following commands:
$ pulp repl
> import Data.Path
> root
/
> isDirectory root
true
> ls root
[/bin/,/etc/,/home/]
thanks in advance.

Related

Getting error while Importing other groovy file in Jenkins pipeline

Generator.groovy*
import jenkins.model.Jenkins
import javaposse.jobdsl.dsl.DslFactory
import com.cs.folderCreation
//Normal code
.............................
EndOfFile*********
----------Error log--------------------------
Generator.groovy: 5: unable to resolve class com.cs.folderCreation
# line 5, column 1.
import com.bmw.cs.folderCreation
^
1 error
Finished: FAILURE
Resloved!
It was just a plugin issue.
Improper configuration can lead to unknown issues.

Python import pdfplumber error " ModuleNotFoundError: No module named 'chardet' "

I encountered an error while importing pdfplumber in Python3, indicating module chardet is missing. However, running pip list from the cmd confirms that the package is installed, version 3.0.4. Anyone had similar experience? Any resolution?
Error Message:
~\AppData\Roaming\Python\Python37\site-packages\pdfminer\utils.py in <module>
3 """
4 import struct
----> 5 import chardet # For str encoding detection
6
7 # from sys import maxint as INF doesn't work anymore under Python3, but PDF
ModuleNotFoundError: No module named 'chardet'
Error: No module named chardet

'no module named setuptools' but it is contained in the DEPENDS variable

This Problem regards Openembedded/Yocto.
I have source code which needs to be compiled by a custom python3 script.
That means, that some python3 script should run during the do_compile() process.
The script imports setuptools, therefore, I added DEPENDS += "python3-setuptools-native" to the recipe. As far as I understand the documentation, this should make the setuptools module available for the building process (native).
But when bitbake executes the do_compile() process, I get this error: no module named 'setuptools'.
Let me break it down to a minimal (non-)working example:
FILE: test.bb
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://test/LICENSE;md5=d41d8cd98f00b204e9800998ecf8427e"
DEPENDS += "python3-setuptools-native"
SRC_URI = "file://test.py \
file://LICENSE"
do_compile() {
python3 ${S}/../test.py
}
FILE: test.py
import setuptools
print("HELLO")
bitbaking:
$ bitbake test
ERROR: test-1.0-r0 do_compile: Function failed: do_compile (log file is located at /path/to/test/1.0-r0/temp/log.do_compile.8532)
ERROR: Logfile of failure stored in: /path/to/test/1.0-r0/temp/log.do_compile.8532
Log data follows:
| DEBUG: Executing shell function do_compile
| Traceback (most recent call last):
| File "/path/to/test-1.0/../test.py", line 1, in <module>
| import setuptools
| ImportError: No module named 'setuptools'
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_compile (log file is located at /path/to/test/1.0-r0/temp/log.do_compile.8532)
ERROR: Task (/path/to/test.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 400 tasks of which 398 didn't need to be rerun and 1 failed.
NOTE: Writing buildhistory
Summary: 1 task failed:
/path/to/test.bb:do_compile
Summary: There was 1 ERROR message shown, returning a non-zero exit code.
Is my exepectation wrong, that DEPENDS += "python3-setuptools-native" makes the python3 module 'setuptools' available to the python3 script in do_compile()? How may I accomplish this?
Under the hood quite a bit more is needed to get working setuptools support. Luckily there's a class to handle that:
inherit setuptools3
This should be all that's need to package a setuptools based project with OE-Core. As long as your project has a standard setup.py you don't need to write any do_compile() or do_install() functions.
If you do need to look at the details, meta/classes/setuptools3.bbclass and meta/classes/distutils3.bbclass should contain what you need (including the rather unobvious way to call native python from a recipe).

unregistered task type import errors in celery

I'm having headaches with getting celery to work with my folder structure. Note I am using virtualenv but it should not matter.
cive /
celery_app.py
__init__.py
venv
framework /
tasks.py
__init__.py
civeAPI /
files tasks.py need
cive is my root project folder.
celery_app.py:
from __future__ import absolute_import
from celery import Celery
app = Celery('cive',
broker='amqp://',
backend='amqp://',
include=['cive.framework.tasks'])
# Optional configuration, see the application user guide.
app.conf.update(
CELERY_TASK_RESULT_EXPIRES=3600,
)
if __name__ == '__main__':
app.start()
tasks.py (simplified)
from __future__ import absolute_import
#import other things
#append syspaths
from cive.celery_app import app
#app.task(ignore_result=False)
def start(X):
# do things
def output(X):
# output files
def main():
for d in Ds:
m = []
m.append( start.delay(X) )
output( [n.get() for n in m] )
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))
I then start workers via (outside root cive dir)
celery -A cive worker --app=cive.celery_app:app -l info
which seems to work fine, loading the workers and showing
[tasks]
. cive.framework.tasks.start_sessions
But when I try to run my tasks.py via another terminal:
python tasks.py
I get the error:
Traceback (most recent call last):
File "tasks.py", line 29, in <module>
from cive.celery_app import app
ImportError: No module named cive.celery_app
If I rename the import to:
from celery_app import app #without the cive.celery_app
I can eventually start the script but celery returns error:
Received unregistered task of type 'cive.start_sessions'
I think there's something wrong with my imports or config but I can't say what.
So this was a python package problem, not particularly a celery issue. I found the solution by looking at How to fix "Attempted relative import in non-package" even with __init__.py .
I've never even thought about this before, but I wasn't running python in package mode. The solution is cd'ing out of your root project directory, then running python as a package (note there is no .py after tasks):
python -m cive.framework.tasks
Now when I run the celery task everything works.

Scrapy crawl on crontab under virtual environment

Trying to run scrapy crawl command using crontab under virtual environment, and getting below error while running scrapy command from cron job -
UserWarning: Cannot import scrapy settings module myspider.settings warnings.warn("Cannot import scrapy settings module
%s" % scrapy_module)
.....
raise KeyError("Spider not found: %s" % spider_name) KeyError: 'Spider not found: myspider'
Any help or suggestion?
It was missing PYTHONPATH while running under crontab.
I have added it before my following cron job:
*/40 * * * * source /home/water/.virtualenvs/water/bin/activate && cd
$HOME/water2012/ && scrapy crawl water2012 >>
$HOME/water2012/log/log_$(date +\%Y\%m\%d).log 2>&1