'SalesforceBulk' object has no attribute 'post_bulk_batch' - python-3.x

I'm trying to run a bulk job in salesforce. After creating job and prepared csv_iterator through my data, when i ran this
batch = bulk.post_bulk_batch(job, csv_iterator)
I'm getting the error stating
AttributeError: 'SalesforceBulk' object has no attribute 'post_bulk_batch'
I've installed salesforce_bulk in python2 and 3 as well. Tried in both versions, but same error.
Why is this happens. How to rectify this issue? Thanks in advance.
UPDATE:
I have installed the version salesforce-bulk==1.1.0
Now it is working in python2 but in python3 this is what happening
from salesforce_bulk import SalesforceBulk
ImportError: cannot import name 'SalesforceBulk'
Is there no support for python 3 to do salesforce bulk job process?

Found it! In python3 install version salesforce-bulk == 2.1.0 and change the method name post_bulk_batch to post_batch
That's it do the trick!

Related

ImportError: Unable to import required dependencies: numpy: error when trying to migrate

I am using Django and Python with Anaconda. At the beginning, I was able to migrate by the addition of a sqlite3.dll file. However, when I try to migrate again, it gives me this error. I have tried uninstalling and installing both numpy and pandas in Project Interpreter. I'm using Pycharm and I'm using Conda Package manager with the Conda environment. I also tried migrate --run-syncdb but it still gives me the error.
How would I fix this to be able to use .objects.bulk_create()?
To fix .objects.bulk_create(), one recommendation was to run migrate --run-syncdb and I cannot run it currently because of the error below.
numpy:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.8 from "C:\Users\PuTung\anaconda3\envs\swe_project\python.exe"
* The NumPy version is: "1.19.2"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: DLL load failed while importing _multiarray_umath: The specified module could not be found.```

What is causing AttributeError: 'list' object has no attribute 'read' when tying to read in a pdf with Tabula?

I am attempting to use Tabula to pull table information from a pdf and convert it to a pandas dataframe. I have been following the steps in this tutorial:
https://aegis4048.github.io/parse-pdf-files-while-retaining-structure-with-tabula-py
When I try to load the remote PDF into my jupyter notebook with the following code (taken directly from the tutorial):
import tabula
df2 = tabula.read_pdf("https://github.com/tabulapdf/tabula-java/raw/master/src/test/resources/technology/tabula/arabic.pdf")
I get the error:
AttributeError: 'list' object has no attribute 'read'
I have tried to read in pdfs saved locally to my machine and I get the same error. I believe I have successfully installed Java and configured the environment variable correctly, and I have the most recent version of Tabula.
Link to screenshot from my jupyter notebook:
https://www.dropbox.com/s/y44mfzuclihfdau/S_O_Capture_1.PNG?dl=0
Thanks.
Make sure you installed the right tabula package!
If you ran pip3 install tabula, then you installed an imposter!
Run pip3 uninstall tabula to remove it, then run:
pip3 install tabula-py
to install the correct package.

How to solve this ModuleNotFoundError: No module named '_sqlite3' in docker-debian

While trying to run scrapy spider in docker-debian every time I get an error:
File "/usr/local/lib/python3.6/site-packages/scrapy/crawler.py", line 82, in
crawl
yield self.engine.open_spider(self.spider, start_requests)
builtins.ModuleNotFoundError: No module named '_sqlite3'
python version 3.6.3
scrapy 1.6.0
tried instruction from this post - ImportError: No module named '_sqlite3' in python3.3
still see this error.
when type sqlite3 command in terminal it shows sqlite3 version and start sqlite terminal.
SQLite version 3.16.2 2017-01-06
when type python and write next command in terminal:
import sqlite3
get this error:
ModuleNotFoundError: No module named '_sqlite3'
is there any way to solve this problem? looks like there is some misconfiguration but I can't find where it's
I have the same error with sqlite3 while I was trying to start my crawler using scrapy crawl my-crawler, after some searches and tried out different solutions, I found this answer useful to my error. Just remember that you need to download your specific python version, mine was 3.8.1 and it worked thanks to their answer. I have already install sqlite3 using sudo apt install libsqlite3-dev. Hope it works in your case, too. So, at first install it then reconfigure your python via instructions in the link.
I had same problem in centos, I just fix it. I install multiple python version in pyenv, so I switch the python version from 3.6 to 3.4.1, then problem solved.Maybe the problem was caused by pyenv,or it's python version's problem. If you don't have pyenv,maybe you need to reinstall python,or install a diffrent version of python.Hope be helpful.

How to properly replace #pytest.mark.gen_test after pytest upgrade to 4.0.2?

I have tornado co-routines tests that passed under pytest 3.8.2, but recently I've upgraded to 4.0.2 and now I get these tests failed with the following message.
#pytest.mark.tryfirst
def pytest_pyfunc_call(pyfuncitem):
gen_test_mark = pyfuncitem.keywords.get('gen_test')
if gen_test_mark:
io_loop = pyfuncitem.funcargs.get('io_loop')
> run_sync = gen_test_mark.kwargs.get('run_sync', True)
E _pytest.warning_types.RemovedInPytest4Warning: MarkInfo objects are deprecated as they contain merged marks which are hard to deal with correctly.
E Please use node.get_closest_marker(name) or node.iter_markers(name).
E Docs: https://docs.pytest.org/en/latest/mark.html#updating-code
/usr/local/lib/python3.5/dist-packages/pytest_tornado/plugin.py:98: RemovedInPytest4Warning
I looked the url suggested and tried to search the web, but unfortunately could figure out nothing by myself.
Tests use #pytest.mark.gen_test decorator.
So, could anyone shed some light on this? How to make these tests pass again?
The issue related to pytest-tornado that I replaced with pytest-tornado-yen3==0.5.2, but unfortunately pytest started crashing with ImportError: No module named 'pytest_tornado'
Eventually I ended up with this.
pip3 uninstall pytest-tornado-yen3 pytest-tornado pytest
pip3 install pytest-tornado-yen3==0.5.2 pytest==4.0.2
And the issue is gone now.

error updating brightway (database_parameters)

I got an error when trying to update brightway.
after doing
conda update -c cmutel bw2io bw2data
I got a warning because there are two possible package resolutions, but updated to bw2data 3.1 and bw2io 0.5.11
now if I try to import brightway I get an import error message
cannot import name 'database_parameters'
SOLVED: I updated conda and then I could update bw2io to version 0.6.RC3 and now I do not have any error message when importing brightway.
Version 3.0 of bw2data changed the way that parameterization works; see the documentation and examples. If there is still a link to database_parameters in the documentation, please file an issue. If you need help migrating database parameters, edit the question.

Resources