how to authenticate in jira with python - python-3.x

from jira.client import JIRA
jira_options={'server': 'https://abcjira.atlassian.net/login?dest- url=%2Fsecure%2FMyJiraHome.jspa'}
jira=JIRA(options=jira_options,basic_auth=('user','password'))
I want to do basic authentication in jira with python. Wrote above code but it gives me traceback. Could anyone please tell me what is the problem here.
Traceback (most recent call last):
File "lab.py", line 5, in <module>
jira=JIRA(options=jira_options,basic_auth=('user','password'))
File "C:\Python34\lib\site-packages\jira\client.py", line 261, in __init__
si = self.server_info()
File "C:\Python34\lib\site-packages\jira\client.py", line 1619, in server_info
return self._get_json('serverInfo')
File "C:\Python34\lib\site-packages\jira\client.py", line 2040, in _get_json
raise e
File "C:\Python34\lib\site-packages\jira\client.py", line 2037, in _get_json
r_json = json_loads(r)
File "C:\Python34\lib\site-packages\jira\utils.py", line 81, in json_loads
return json.loads(r.text)
File "C:\Python34\lib\json\__init__.py", line 318, in loads
return _default_decoder.decode(s)
File "C:\Python34\lib\json\decoder.py", line 343, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Python34\lib\json\decoder.py", line 361, in raw_decode
raise ValueError(errmsg("Expecting value", s, err.value)) from None
ValueError: Expecting value: line 4 column 1 (char 3)

Related

Error when using joblib in python with undetected chromedriver

when i use (self.links is an array of strings)
Parallel(n_jobs=2)(delayed(self.buybysize)(link) for link in self.links)
with this function
def buybysize(self, link):
browser = self.browser()
//other commented stuff
def browser(self):
options = uc.ChromeOptions()
options.user_data_dir = self.user_data_dir
options.add_argument(self.add_argument)
driver = uc.Chrome(options=options)
return driver
i get the error
oblib.externals.loky.process_executor._RemoteTraceback:
Traceback (most recent call last):
File "/home/Me/PycharmProjects/zalando_buy/venv/lib/python3.8/site-packages/joblib/externals/loky/process_executor.py", line 436, in _process_worker
r = call_item()
File "/home/Me/PycharmProjects/zalando_buy/venv/lib/python3.8/site-packages/joblib/externals/loky/process_executor.py", line 288, in __call__
return self.fn(*self.args, **self.kwargs)
File "/home/Me/PycharmProjects/zalando_buy/venv/lib/python3.8/site-packages/joblib/_parallel_backends.py", line 595, in __call__
return self.func(*args, **kwargs)
File "/home/Me/PycharmProjects/zalando_buy/venv/lib/python3.8/site-packages/joblib/parallel.py", line 262, in __call__
return [func(*args, **kwargs)
File "/home/Me/PycharmProjects/zalando_buy/venv/lib/python3.8/site-packages/joblib/parallel.py", line 262, in <listcomp>
return [func(*args, **kwargs)
File "/home/Me/PycharmProjects/zalando_buy/Zalando.py", line 91, in buybysize
browser = self.browser()
File "/home/Me/PycharmProjects/zalando_buy/Zalando.py", line 38, in browser
driver = uc.Chrome(options=options)
File "/home/Me/PycharmProjects/zalando_buy/venv/lib/python3.8/site-packages/undetected_chromedriver/__init__.py", line 388, in __init__
self.browser_pid = start_detached(
File "/home/Me/PycharmProjects/zalando_buy/venv/lib/python3.8/site-packages/undetected_chromedriver/dprocess.py", line 30, in start_detached
multiprocessing.Process(
File "/usr/lib/python3.8/multiprocessing/process.py", line 121, in start
self._popen = self._Popen(self)
File "/usr/lib/python3.8/multiprocessing/context.py", line 224, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "/home/Me/PycharmProjects/zalando_buy/venv/lib/python3.8/site-packages/joblib/externals/loky/backend/process.py", line 39, in _Popen
return Popen(process_obj)
File "/home/Me/PycharmProjects/zalando_buy/venv/lib/python3.8/site-packages/joblib/externals/loky/backend/popen_loky_posix.py", line 52, in __init__
self._launch(process_obj)
File "/home/Me/PycharmProjects/zalando_buy/venv/lib/python3.8/site-packages/joblib/externals/loky/backend/popen_loky_posix.py", line 157, in _launch
pid = fork_exec(cmd_python, self._fds, env=process_obj.env)
AttributeError: 'Process' object has no attribute 'env'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/Me/PycharmProjects/zalando_buy/Start.py", line 4, in <module>
class Start:
File "/home/Me/PycharmProjects/zalando_buy/Start.py", line 7, in Start
zalando.startshopping()
File "/home/Me/PycharmProjects/zalando_buy/Zalando.py", line 42, in startshopping
self.openlinks()
File "/home/Me/PycharmProjects/zalando_buy/Zalando.py", line 50, in openlinks
Parallel(n_jobs=2)(delayed(self.buybysize)(link) for link in self.links)
File "/home/Me/PycharmProjects/zalando_buy/venv/lib/python3.8/site-packages/joblib/parallel.py", line 1056, in __call__
self.retrieve()
File "/home/Me/PycharmProjects/zalando_buy/venv/lib/python3.8/site-packages/joblib/parallel.py", line 935, in retrieve
self._output.extend(job.get(timeout=self.timeout))
File "/home/Me/PycharmProjects/zalando_buy/venv/lib/python3.8/site-packages/joblib/_parallel_backends.py", line 542, in wrap_future_result
return future.result(timeout=timeout)
File "/usr/lib/python3.8/concurrent/futures/_base.py", line 444, in result
return self.__get_result()
File "/usr/lib/python3.8/concurrent/futures/_base.py", line 389, in __get_result
raise self._exception
AttributeError: 'Process' object has no attribute 'env'
Process finished with exit code 1
For me it looks like there are instabilities because undetected chromedriver maybe uses multiprocessing already, but isnt there any way where i can open multiple Browsers with UC and process each iteration parallel?
Edit: i debugged and the error appears after trying to execute this line:
driver = uc.Chrome(options=options)

Odoo 11 throws error on customer/partner listing after upgrade from odoo 10

I have recently upgraded an odoo 10 instance to odoo 11 using an open upgrade. After deleting projects module (apparently it cannot be properly migrated) and fixing some custom module I finally do have a running odoo 11 instance. However, whenever I try to click on customers/vendors odoo throws this error:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 948, in __get__
value = record.env.cache.get(record, self)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 977, in get
value = self._data[key][field][record._ids[0]]
KeyError: 421
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 948, in __get__
value = record.env.cache.get(record, self)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 977, in get
value = self._data[key][field][record._ids[0]]
KeyError: 421
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/http.py", line 653, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 312, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/usr/lib/python3/dist-packages/odoo/tools/pycompat.py", line 87, in reraise
raise value
File "/usr/lib/python3/dist-packages/odoo/http.py", line 695, in dispatch
result = self._call_function(**self.params)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 344, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 97, in wrapper
return f(dbname, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 337, in checked_call
result = self.endpoint(*a, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 939, in __call__
return self.method(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 517, in response_wrap
response = f(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 934, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 926, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 697, in call_kw
return call_kw_model(method, model, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 682, in call_kw_model
result = method(recs, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 1296, in load_views
for [v_id, v_type] in views
File "/usr/lib/python3/dist-packages/odoo/models.py", line 1296, in <dictcomp>
for [v_id, v_type] in views
File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_thread.py", line 374, in fields_view_get
res = super(MailThread, self).fields_view_get(view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 1375, in fields_view_get
result = self._fields_view_get(view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu)
File "/usr/lib/python3/dist-packages/odoo/addons/base/res/res_partner.py", line 318, in _fields_view_get
res = super(Partner, self)._fields_view_get(view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 1338, in _fields_view_get
root_view = View.browse(view_id).read_combined(['id', 'name', 'field_parent', 'type', 'model', 'arch'])
File "/usr/lib/python3/dist-packages/odoo/addons/base/ir/ir_ui_view.py", line 730, in read_combined
arch = self.apply_view_inheritance(arch_tree, root.id, self.model)
File "/usr/lib/python3/dist-packages/odoo/addons/base/ir/ir_ui_view.py", line 674, in apply_view_inheritance
sql_inherit = self.get_inheriting_views_arch(source_id, model)
File "/usr/lib/python3/dist-packages/odoo/addons/base/ir/ir_ui_view.py", line 498, in get_inheriting_views_arch
for view in views.sudo()
File "/usr/lib/python3/dist-packages/odoo/addons/base/ir/ir_ui_view.py", line 499, in <listcomp>
if not view.groups_id or (view.groups_id & user_groups)]
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 952, in __get__
self.determine_value(record)
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1065, in determine_value
self.compute_value(recs)
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1019, in compute_value
self._compute_value(records)
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1010, in _compute_value
getattr(records, self.compute)()
File "/usr/lib/python3/dist-packages/odoo/addons/base/ir/ir_ui_view.py", line 260, in _compute_arch
view.arch = pycompat.to_text(arch_fs or view.arch_db)
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 952, in __get__
self.determine_value(record)
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1055, in determine_value
record._prefetch_field(self)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 2663, in _prefetch_field
result = records.read([f.name for f in fs], load='_classic_write')
File "/usr/lib/python3/dist-packages/odoo/models.py", line 2601, in read
self._read_from_database(stored, inherited)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 2744, in _read_from_database
values[index] = translate(ids[index], values[index])
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1344, in translate
return self.translate(src_trans.get, value)
File "/usr/lib/python3/dist-packages/odoo/tools/translate.py", line 306, in xml_translate
try:
File "/usr/lib/python3/dist-packages/odoo/tools/translate.py", line 284, in parse_xml
return etree.fromstring(bytes(text, encoding='utf-8'))
File "src/lxml/lxml.etree.pyx", line 3213, in lxml.etree.fromstring (src/lxml/lxml.etree.c:79003)
File "src/lxml/parser.pxi", line 1843, in lxml.etree._parseMemoryDocument (src/lxml/lxml.etree.c:118275)
ValueError: Unicode strings with encoding declaration are not supported. Please use bytes input or XML fragments without declaration.
this seems pretty odd since whatever I read suggests to really change the odoo code itself, which I feel I should definitely not do. However, does anyone have a direction on where to look for this issue? I see that in translate.py there is an xml_parse without any encoding, but if this would be the root cause odoo itself shouldn't be working at all, but it works on a fresh instance, so the root cause must be something else then.
Thanks for any hint.
UPDATE: some further details
what i was trying to achieve:
I run an instance of odoo 10 and wante to upgrade it to odoo 11 using https://github.com/OCA/OpenUpgrade. This worked in the sense that all data was migrated and I had a working odoo 11 instance running. Before upgrading i stripped the odoo 10 instance to the bare minimum of modules to not infer any further conflicts/issues while upgrading. Si after upgrading i could log in and all looked good, except when i click on any view that is supposed to display customer data. There i get the error message as describe above. It seems there is some problem during upgrading that causes this issue. But i have no idea what this could be. I though i could export & delete all customers in the old instance, upgrade and import those, but this is of course not possible since there are documents/invoices attached to the customers. So this is not an option...
any ideas?

'Permission Error' (denied) while writing xml file using ElementTree on Odoo11 (Odoo.sh)

I'm getting the following error. Which is about permissions. The error occurs when I call a custom method through an action. The custom method will create an .xml using ElementTree library.
The code inside the method is about 1500+ lines so putting it in here wouldn't be optimal. But I believe the method is rejected when trying the following
tree.write("20100066603-01-F001-1.xml", "ISO-8859-1", True)
This is the error. Odoo returns
Error:
Odoo Server Error
Traceback (most recent call last):
File "/usr/lib/python3.6/xml/etree/ElementTree.py", line 789, in _get_writer
write = file_or_filename.write
AttributeError: 'str' object has no attribute 'write'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/tools/safe_eval.py", line 350, in safe_eval
return unsafe_eval(c, globals_dict, locals_dict)
File "", line 2, in <module>
File "/usr/lib/python3/dist-packages/odoo/addons/myModule/models/models.py", line 1141, in x_nc_create_xml
tree.write("20100066603-01-F001-1.xml", "ISO-8859-1", True)
File "/usr/lib/python3.6/xml/etree/ElementTree.py", line 759, in write
with _get_writer(file_or_filename, enc_lower) as write:
File "/usr/lib/python3.6/contextlib.py", line 81, in __enter__
return next(self.gen)
File "/usr/lib/python3.6/xml/etree/ElementTree.py", line 796, in _get_writer
errors="xmlcharrefreplace")
PermissionError: [Errno 13] Permission denied: '20100066603-01-F001-1.xml'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/http.py", line 650, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 310, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/usr/lib/python3/dist-packages/odoo/tools/pycompat.py", line 87, in reraise
raise value
File "/usr/lib/python3/dist-packages/odoo/http.py", line 692, in dispatch
result = self._call_function(**self.params)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 342, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 97, in wrapper
return f(dbname, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 335, in checked_call
result = self.endpoint(*a, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 936, in __call__
return self.method(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 515, in response_wrap
response = f(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1231, in run
result = request.env['ir.actions.server'].browse([action_id]).run()
File "/usr/lib/python3/dist-packages/odoo/addons/base/ir/ir_actions.py", line 554, in run
res = func(action, eval_context=eval_context)
File "/usr/lib/python3/dist-packages/odoo/addons/base/ir/ir_actions.py", line 430, in run_action_code_multi
safe_eval(action.sudo().code.strip(), eval_context, mode="exec", nocopy=True) # nocopy allows to return 'action'
File "/usr/lib/python3/dist-packages/odoo/tools/safe_eval.py", line 373, in safe_eval
pycompat.reraise(ValueError, ValueError('%s: "%s" while evaluating\n%r' % (ustr(type(e)), ustr(e), expr)), exc_info[2])
File "/usr/lib/python3/dist-packages/odoo/tools/pycompat.py", line 86, in reraise
raise value.with_traceback(tb)
File "/usr/lib/python3/dist-packages/odoo/tools/safe_eval.py", line 350, in safe_eval
return unsafe_eval(c, globals_dict, locals_dict)
File "", line 2, in <module>
File "/usr/lib/python3/dist-packages/odoo/addons/myModule/models/models.py", line 1141, in x_nc_create_xml
tree.write("20100066603-01-F001-1.xml", "ISO-8859-1", True)
File "/usr/lib/python3.6/xml/etree/ElementTree.py", line 759, in write
with _get_writer(file_or_filename, enc_lower) as write:
File "/usr/lib/python3.6/contextlib.py", line 81, in __enter__
return next(self.gen)
File "/usr/lib/python3.6/xml/etree/ElementTree.py", line 796, in _get_writer
errors="xmlcharrefreplace")
ValueError: <class 'PermissionError'>: "13
Permission denied" while evaluating
'if records: \n action = records.x_nc_create_xml()'
I have already tried the same code on PyCharm and it worked. So I believe, this is an issue about permissions on Odoo.
How do I set permission for my module to create,edit and delete files it creates?
PD:If this is unlikely to achieve on Odoo.sh, then how can I do it on a Local installation? I currently have both.
use command chmod 777 * this will allow all kind of access to all of your custom modules and if you want to give permission to only one module use name of module instead of * like this chmod 777 module_name

Twython: How to update profile banner?

What am I doing wrong?
twitter = twython.Twython(api_key, api_secret, access_token, token_secret)
banner_file = open('banner.jpg', 'rb')
twitter.update_profile_banner_image(banner=banner_file)
Calling this returns:
Traceback (most recent call last): File
"/usr/local/lib/python3.5/dist-packages/twython/api.py", line 202, in
_request
content = response.json() File "/usr/local/lib/python3.5/dist-packages/requests/models.py", line 812,
in json
return complexjson.loads(self.text, **kwargs) File "/usr/lib/python3.5/json/init.py", line 319, in loads
return _default_decoder.decode(s) File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char
0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "tuit.py", line 45, in
twitter.update_profile_banner_image(banner=banner) File "/usr/local/lib/python3.5/dist-packages/twython/endpoints.py", line
493, in update_profile_banner_image
return self.post('account/update_profile_banner', params=params) File "/usr/local/lib/python3.5/dist-packages/twython/api.py", line
270, in post
return self.request(endpoint, 'POST', params=params, version=version) File
"/usr/local/lib/python3.5/dist-packages/twython/api.py", line 260, in
request
api_call=url) File "/usr/local/lib/python3.5/dist-packages/twython/api.py", line 205, in
_request
Unable to decode.') twython.exceptions.TwythonError: Response was not valid JSON. Unable to decode.

SyntaxError raised when using joblib with lxml on python 3.5

I am trying to parallelize the tasks of correcting texts on many documents with Python, so I naturally found "joblib". I want each task to be to correct a given document. Here is the structure of the code:
if __name__ == '__main__':
lexicon = build_compact_lexicon()
from joblib import Parallel, delayed
import multiprocessing
num_cores = multiprocessing.cpu_count()
results = Parallel(n_jobs=num_cores)(delayed(find_errors)('GDL', i, 1, lexicon) for i in range(1798, 1820))
I am using the function find_errors summed up here :
def find_errors(newspaper, year, month, lexicon):
# parse the input newspaper text data using etree parser from LXML
# detect errors in the text
return found_errors_type1, found_errors_type2, found_errors_type3
This does raise me a few errors
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/home/mbl/anaconda3/envs/OCR_Correction/lib/python3.5/site-packages/joblib/parallel.py", line 130, in __call__
return self.func(*args, **kwargs)
File "/home/mbl/anaconda3/envs/OCR_Correction/lib/python3.5/site-packages/joblib/parallel.py", line 72, in __call__
return [func(*args, **kwargs) for func, args, kwargs in self.items]
File "/home/mbl/anaconda3/envs/OCR_Correction/lib/python3.5/site-packages/joblib/parallel.py", line 72, in <listcomp>
return [func(*args, **kwargs) for func, args, kwargs in self.items]
File "hellowordParallel.py", line 85, in find_errors
tree = etree.parse(xml_file_path)
File "src/lxml/lxml.etree.pyx", line 3427, in lxml.etree.parse (src/lxml/lxml.etree.c:79801)
File "src/lxml/parser.pxi", line 1805, in lxml.etree._parseDocument (src/lxml/lxml.etree.c:116293)
TypeError: cannot parse from 'NoneType'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/mbl/anaconda3/envs/OCR_Correction/lib/python3.5/tokenize.py", line 392, in find_cookie
line_string = line.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb0 in position 24: invalid start byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/mbl/anaconda3/envs/OCR_Correction/lib/python3.5/multiprocessing/pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "/home/mbl/anaconda3/envs/OCR_Correction/lib/python3.5/site-packages/joblib/parallel.py", line 139, in __call__
tb_offset=1)
File "/home/mbl/anaconda3/envs/OCR_Correction/lib/python3.5/site-packages/joblib/format_stack.py", line 373, in format_exc
frames = format_records(records)
File "/home/mbl/anaconda3/envs/OCR_Correction/lib/python3.5/site-packages/joblib/format_stack.py", line 274, in format_records
for token in generate_tokens(linereader):
File "/home/mbl/anaconda3/envs/OCR_Correction/lib/python3.5/tokenize.py", line 514, in _tokenize
line = readline()
File "/home/mbl/anaconda3/envs/OCR_Correction/lib/python3.5/site-packages/joblib/format_stack.py", line 265, in linereader
line = getline(file, lnum[0])
File "/home/mbl/anaconda3/envs/OCR_Correction/lib/python3.5/linecache.py", line 16, in getline
lines = getlines(filename, module_globals)
File "/home/mbl/anaconda3/envs/OCR_Correction/lib/python3.5/linecache.py", line 47, in getlines
return updatecache(filename, module_globals)
File "/home/mbl/anaconda3/envs/OCR_Correction/lib/python3.5/linecache.py", line 136, in updatecache
with tokenize.open(fullname) as fp:
File "/home/mbl/anaconda3/envs/OCR_Correction/lib/python3.5/tokenize.py", line 456, in open
encoding, lines = detect_encoding(buffer.readline)
File "/home/mbl/anaconda3/envs/OCR_Correction/lib/python3.5/tokenize.py", line 433, in detect_encoding
encoding = find_cookie(first)
File "/home/mbl/anaconda3/envs/OCR_Correction/lib/python3.5/tokenize.py", line 397, in find_cookie
raise SyntaxError(msg)
File "<string>", line None
SyntaxError: invalid or missing encoding declaration for '/home/mbl/anaconda3/envs/OCR_Correction/lib/python3.5/site-packages/lxml/etree.so'
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "hellowordParallel.py", line 160, in <module>
results = Parallel(n_jobs=num_cores)(delayed(find_errors)('GDL', i, 1, lexicon) for i in range(1798, 1820))
File "/home/mbl/anaconda3/envs/OCR_Correction/lib/python3.5/site-packages/joblib/parallel.py", line 810, in __call__
self.retrieve()
File "/home/mbl/anaconda3/envs/OCR_Correction/lib/python3.5/site-packages/joblib/parallel.py", line 727, in retrieve
self._output.extend(job.get())
File "/home/mbl/anaconda3/envs/OCR_Correction/lib/python3.5/multiprocessing/pool.py", line 608, in get
raise self._value
SyntaxError: invalid or missing encoding declaration for '/home/mbl/anaconda3/envs/OCR_Correction/lib/python3.5/site-packages/lxml/etree.so'
I don't understand if this is due do something related with configs or if my function doesn't fit in a parallel implementation... (I guess it should...)
Did it happen to some of you before?
Hope my question is clear and there is enough information for someone to give me some help!

Resources