File "custom.py", line 43, in job
session.like_by_tags
File "/home/pi/InstaPy/instapy/instapy.py", line 1105, in like_by_tags
self.logger)
ValueError: need more than 4 values to unpack
i've checked the code in instapy.py, seems the same. What is wrong?
@aku6640,
Smells like your files are not fully identical with main files.
And the source of that error lies in the like_by_tags
method of instapy.py file:
There,
inappropriate, user_name, is_video, reason, scope = (
check_link(self.browser,
link,
self.dont_like,
self.ignore_if_contains,
self.ignore_users,
self.username,
self.potency_ratio,
self.delimit_by_numbers,
self.max_followers,
self.max_following,
self.min_followers,
self.min_following,
self.logger)
in current check_link
definition, it _returns_ 5
_values_ AND it seems you have not added new scope
variable to catch that 5
th _return value_ (_previously it was 4
_return values_ before scope
added_) OR check_link
definition in your like_util.py file returns 4
values instead of needed 5
.
_If not fully pulling repository, make those missing changes manually._
It is always best to pull entire changes AND make & keep your custom modifications (_if any_) in separate files rather than in core files.
thanks man, but I couldn't find the problem. I did a hard reset and now I get new problems.
I hope you can help me out, thank you for your time!
Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
Traceback (most recent call last):
File "/home/pi/InstaPy/instapy/instapy.py", line 276, in set_selenium_local_session
chrome_options=chrome_options)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/webdriver.py", line 62, in __init__
self.service.start()
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/service.py", line 71, in start
os.path.basename(self.path), self.start_error_message)
WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
Traceback (most recent call last):
File "custom.py", line 23, in
multi_logs=True)
File "/home/pi/InstaPy/instapy/instapy.py", line 170, in __init__
self.set_selenium_local_session()
File "/home/pi/InstaPy/instapy/instapy.py", line 280, in set_selenium_local_session
Settings.chromedriver_location))
instapy.instapy.InstaPyError: ensure chromedriver is installed at /home/pi/InstaPy/assets/chromedriver
Exception AttributeError: "'Service' object has no attribute 'process'" in
I've tried to download chromedriver, move it to the assets folder, but still not working..?
It's a pleasure, @aku6640,
Is the chromedriver unzipped?
How did you do hard reset
post that crashing quickstart for more troubleshooting
Yes I've directly unzipped it to the assets directory.
for the hard reset I did:
git fetch origin
git reset --hard HEAD
git clean -xffd
git pull
I saw that the chromedriver was not unzipper (strange? lol) so I did that and now I get an different error.
It says: Traceback (most recent call last):
File "custom.py", line 17, in
Settings.database_location = '/home/pi/InstaPy/db/instapy.db'
NameError: name 'Settings' is not defined
here is my custom.py file (quickstart):
import os
import time
import schedule
from tempfile import gettempdir
from selenium.common.exceptions import NoSuchElementException
from instapy import InstaPy
insta_username = 'x'
insta_password = 'x'
Settings.database_location = '/home/pi/InstaPy/db/instapy.db'
Settings.chromedriver_location = '/home/pi/InstaPy/instapy/assets/chromedriver'
session = InstaPy(username='x',
password='x',
headless_browser=True,
multi_logs=True)
def job():
try:
session.login()
# settings
session.set_relationship_bounds(enabled=True,
potency_ratio=False,
delimit_by_numbers=False,
max_followers=4590,
max_following=5555,
min_followers=45,
min_following=77)
session.set_do_comment(False, percentage=10)
#session.set_comments(['aMEIzing!', 'So much fun!!', 'Nicey!'])
#session.set_dont_include(['friend1', 'friend2', 'friend3']
# actions
session.like_by_tags(['x'], amount=5)
session.follow_user_followers(['x'], amount=20,randomize=False, sleep_delay=60*5)
session.unfollow_users(amount=400, onlyInstapyFollowed = True, onlyInstapyMethod = 'FIFO', sleep_delay=600, unfollow_after=48*60*60)
session.end()
except:
import traceback
print(traceback.format_exc())
schedule.every().day.at("5:53").do(job)
schedule.every().day.at("13:26").do(job)
schedule.every().day.at("17:53").do(job)
schedule.every().day.at("21:06").do(job)
schedule.every().day.at("23:57").do(job)
while True:
schedule.run_pending()
time.sleep(1)
It's great! @aku6640,
To be able to _instantiate_ Settings
class, you must first import it:
from instapy import Settings
Settings
class helps you define your DB
, log
and webdriver
files once they are located outside the default locations.
If you have not relocated them, just _comment out_ Settings
lines at the quickstart script.
thank you!
I've done that, but still get this error:
Traceback (most recent call last):
File "custom.py", line 24, in
multi_logs=True)
File "/home/pi/InstaPy/instapy/instapy.py", line 170, in __init__
self.set_selenium_local_session()
File "/home/pi/InstaPy/instapy/instapy.py", line 276, in set_selenium_local_session
chrome_options=chrome_options)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/webdriver.py", line 62, in __init__
self.service.start()
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/service.py", line 64, in start
stdout=self.log_file, stderr=self.log_file)
File "/usr/lib/python2.7/subprocess.py", line 390, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1024, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error
I have downloaded the latest chromedriver and put it in the assets folder and gave permissions with chmod +x chromedriver and chmod 755 chromedriver , still same error
@aku6640,
That error message suggests that the external program is not a valid executable.
Looks like this is complaining about the format of chromedriver binary. It might be because of platform and chromedriver format mismatch. For example windows requires chromedriver.exe
while there are different formats for linux and mac.
Make sure you have downloaded correct chromedriver executable according to your Operating System from this official site
Also use detaulf assets folder as a chromedriver location and _comment out_ this line in your quickstart script,
Settings.chromedriver_location = '/home/pi/InstaPy/instapy/assets/chromedriver'
_or make sure that the path is correct if you want to use Settings
class_
you were right mate, how stupid of me, had the linux version and im using an raspberry pi.. haha thanks!
But now I am back at the same problem again with the"'need more than 4 values to unpack" error. When you look at my code, do you know what I have to add?
in the instapy.py file I have the same method as you showed, with the same variables
That's good @aku6640,
If you did pull full repository, you should not see that error.
_In your like_util.py, there is a check_link
definition and it must return 5
values but it looks like you have not updated it, and it still returns 4
values which is making the problem._
Do you find troubles pulling new commits?
yes, the pulls don't work good or something. I also had to manually change the like util commits, which it also didn't pull. I don't understand why, because I also did a hard reset.. do you know what could cause this?
@aku6640,
Well, for using InstaPy better or any other GitHub project, you should get familiar with using git
.
After you master it, it will ease your work and increase performance with latest updates every time!
First, grab the idea of NOT TOUCHING core files.
That will ease the process of merging new commits easily. Otherwise you will have to solve conflicting lines every time.
E.g. if you have modifications, make it outside of core files so that they don't conflict.
To learn git
commands, run a google search to find a good tutorial
But basically, you will use
git stash
to hide your personal modifications,
git pop
to bring back modifications after pull
s.
I am not familiar with Linux, or I could help more, I use GitHub _desktop app_ in Windows 10 machine and used
git
only forrebase
,squash
,stash
andpop
commands.
BTW run git log
and it will show up the commits history, tell me the latest commit you got in there
thanks again!
here's my log:
commit 8d3ea3bbb798b087acef4099977d816885eb3811
Author: X
Date: Sat May 12 02:38:44 2018 +0000
instapy/like_util.py
commit e6c0071a9b17d64a30958e51eefb7cd063ae2648
Merge: 7ab3346 bebcd8c
Author: Tim Gro脽mann t.grossmann1994@web.de
Date: Fri May 11 15:40:19 2018 +0200
Merge pull request #1981 from uluQulu/master
Revised and enhanced `follow_commenters`, `follow_user_likers` (now is renamed to `follow_likers`) and `follow_by_list` features to have smart 'sleep_delay' and 'interact' capability
commit 7ab3346b0fc8c60039b12457e6b98cc25ec7fa84
Merge: bff8a7c 3eda959
Author: Tim Gro脽mann t.grossmann1994@web.de
Date: Fri May 11 15:39:10 2018 +0200
Merge pull request #1997 from redsector72/master
:
Welcome @aku6640,
It seems to be up-to-date,
Can you share those like_util.py and instapy.py files in your currently used folder? (_zip it to _attach_ here OR just gist 'em_)
oh I just copied the complete check_link method and now it runs again! thank you very much for your time!
I don't know why it didn't pull good, I just copied the files from here and deleted my complete method.
Good that it works my friend :)
@aku6640,
_Although specifically replacing files with latest ones did work, it is not a good practice, cos you might forget to merge some file which would make problems in future.._
Try to get more familiar with git
commands and let it does its job.
Good luck!
yes you are very right my friend!
So how would I pull from now on to do it right?
steps:
git stash
to hide your personal modifications,
git pull -> pull commits
git pop
to bring back modifications after pulls.
with this I could use quickstart as script and not my custom.py, is this right, because now I always manually change things in my custom script, but my script is also different than the quickstart script. What do you recommend for me?
@aku6640,
We can check for changes on our GitHub repository and pull down any new changes by running:
git pull origin master
_it will pull all the new files from the branch- master
_
But before trying to pull, always check the status
of your local (cloned) repository with,
git status
which will return you all of the modified and/or untrackted (_newly created files by you_):
At this step, if you have any modified file. Then you must stash
your modifications to proceed. (untracked files does not make problems. Only stash
if you have any modified file)
git stash
But if there are no any modified file, then you do not need stash
command, start to pull and make sure you are in master
.
git checkout master
git pull origin master
After you have did pull
successfully, you should pop
back your previous modifications (_if any_).
git pop
stash
& pop
, then it is time to solve conflicts.stash
& pop
, then you are good to go.Now you have successfully pulled latest files from the remote repository :)
Please take your time to read a good tutorial found in many parts of the internet!
Also, use git help <command>
,
_e.g._,
git help config
#or
git help stash
Note that, unlike that screenshot of mine above, most of the time the only modified file you will see will be instapy.db
unless you will modify _core files_ which is what I do not recommend.
If you want to modify core files, make a duplicate of them and keep core files untouched. That's why after each stash
, pull
, pop
, you will not need to solve any conflicts (_raw files like instapy.db will not make conflicts_)
Good luck!
that's very helpful man, thanks! You are helping out a lot my friend, thanks for your time!
I have unfortunately an error again. It just came up after a few hours?
Traceback (most recent call last):
File "custom.py", line 28, in job
session.login()
File "/home/pi/InstaPy/instapy/instapy.py", line 322, in login
self.bypass_suspicious_attempt):
File "/home/pi/InstaPy/instapy/login_util.py", line 98, in login_user
browser.get('https://www.instagram.com')
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 248, in get
self.execute(Command.GET, {'url': url})
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 234, in execute
response = self.command_executor.execute(driver_command, params)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/remote_connection.py", line 401, in execute
return self._request(command_info[0], url, body=data)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/remote_connection.py", line 432, in _request
self._conn.request(method, parsed_url.path, body, headers)
File "/usr/lib/python2.7/httplib.py", line 1042, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python2.7/httplib.py", line 1082, in _send_request
self.endheaders(body)
File "/usr/lib/python2.7/httplib.py", line 1038, in endheaders
self._send_output(message_body)
File "/usr/lib/python2.7/httplib.py", line 882, in _send_output
self.send(msg)
File "/usr/lib/python2.7/httplib.py", line 844, in send
self.connect()
File "/usr/lib/python2.7/httplib.py", line 821, in connect
self.timeout, self.source_address)
File "/usr/lib/python2.7/socket.py", line 575, in create_connection
raise err
error: [Errno 111] Connection refused
Traceback (most recent call last):
File "custom.py", line 28, in job
session.login()
File "/home/pi/InstaPy/instapy/instapy.py", line 322, in login
self.bypass_suspicious_attempt):
File "/home/pi/InstaPy/instapy/login_util.py", line 98, in login_user
browser.get('https://www.instagram.com')
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 248, in get
self.execute(Command.GET, {'url': url})
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 234, in execute
response = self.command_executor.execute(driver_command, params)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/remote_connection.py", line 401, in execute
return self._request(command_info[0], url, body=data)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/remote_connection.py", line 432, in _request
self._conn.request(method, parsed_url.path, body, headers)
File "/usr/lib/python2.7/httplib.py", line 1042, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python2.7/httplib.py", line 1082, in _send_request
self.endheaders(body)
File "/usr/lib/python2.7/httplib.py", line 1038, in endheaders
self._send_output(message_body)
File "/usr/lib/python2.7/httplib.py", line 882, in _send_output
self.send(msg)
File "/usr/lib/python2.7/httplib.py", line 844, in send
self.connect()
File "/usr/lib/python2.7/httplib.py", line 821, in connect
self.timeout, self.source_address)
File "/usr/lib/python2.7/socket.py", line 575, in create_connection
raise err
error: [Errno 111] Connection refused
Welcome @aku6640,
This time it is out of my knowledge that I can't help much of.
But it fails to execute selenium get
command.
This can be due to several reasons.
But first make sure you are using latest versions of web browser
(_Chrome_ or _Firefox_), webdriver
(_chromedriver_ or _geckodriver_) & selenium
.
If you are using pip
, this command will _update_ selenium
:
pip install -U selenium
If it does not help, you can search Issues related to this, I am sure someone offered a working solution.
Also, is that problem persistent or happens from time to time?
I have upgraded selenium now and it seems to work, but last time it also crashed in 1-2 hours so I will keep an eye on it.
thanks for all your help, much appreciated bro!
Still getting the error 111
could be because of this? I tried the git stash etc. what you described above but now I am getting this:
pi@raspberrypi:~/InstaPy $ git status
On branch master
Your branch and 'origin/master' have diverged,
and have 1 and 4 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
You have unmerged paths.
(fix conflicts and run "git commit")
(use "git merge --abort" to abort the merge)
Changes to be committed:
modified: instapy/comment_util.py
modified: instapy/instapy.py
modified: instapy/unfollow_util.py
modified: instapy/util.py
Unmerged paths:
(use "git add
both modified: instapy/like_util.py
Untracked files:
(use "git add
custom.py
custom1.py
pi@raspberrypi:~/InstaPy $ git commit
U instapy/like_util.py
error: Committing is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.
pi@raspberrypi:~/InstaPy $ git pull
error: Pulling is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.
pi@raspberrypi:~/InstaPy $
Yes, it happens after pulling some commits,
_open up your text editor of choice and find conflicting lines and solve them, then run_
git add <filename>
##e.g.,
git add comment_util.py
<<<<<<< HEAD:mergetest
This is my third line
=======
This is a fourth line I am adding
>>>>>>> 4e2b407f501b68f8588aa645acafffa0224b9b78:mergetest
_explained as_,
<<<<<<<: Indicates the start of the lines that had a merge conflict. The first set of lines are the lines from the file that you were trying to merge the changes into.
```erlang
=======: Indicates the break point used for comparison. Breaks up changes that user has committed (above) to changes coming from merge (below) to visually see the differences.
```erlang
>>>>>>>: Indicates the end of the lines that had a merge conflict.
You resolve a conflict by editing the file to manually merge the parts of the file that git had trouble merging. This may mean discarding either your changes or someone else's or doing a mix of the two. You will also need to delete the '<<<<<<<', '=======', and '>>>>>>>' in the file.
For you in this case, will just keep the updated changes and remove old ones.
If you were using Atom editor, it would be a lot easier
It is very easy, just take a few minutes of your time to learn it and use forever! 馃挭馃徏
finally fixed this error no 111 with:
sudo rm -i /etc/apt/sources.list.d/xenial-partner.list
the xenial-partner.list I changed with the error my list was giving so if anyone gets this message too you have to change that part.
after that:
sudo apt-get update
sudo apt-get upgrade
and now its working fine again!
lol, not working again.. error:
Traceback (most recent call last):
File "custom.py", line 45, in job
session.follow_user_followers(['x'], amount=20,randomize=False, sleep_delay=60*5)
File "/home/pi/InstaPy/instapy/instapy.py", line 1907, in follow_user_followers
self.logfolder)
ValueError: need more than 0 values to unpack
anyone ideas?
@aku6640
Make sure you have latest files and still if not works, attach zipped instapy.py and unfollow_util.py files to have a look
now working, but I don't know for how long. It just randomly pops up after a few hours!
edit: still crashes, same error
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this problem still occurs, please open a new issue
Most helpful comment
I have upgraded selenium now and it seems to work, but last time it also crashed in 1-2 hours so I will keep an eye on it.
thanks for all your help, much appreciated bro!