Instapy: Absolute paths

Created on 26 Apr 2017  路  8Comments  路  Source: timgrossmann/InstaPy

I ran twice in issues with paths in instapy.py:

  1. When I tried to add a cronjob for python /my/path/to/instapy/quickstart.py and tested it with bash mode env -i /bin/bash --noprofile --norc
  2. When I tried to use InstaPy with command on command line mode

InstaPy would stop executing with following message:

File "/usr/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 71, in start
    os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

Exception AttributeError: "'Service' object has no attribute 'process'" in <bound method Service.__del__ of <selenium.webdriver.chrome.service.Service object at 0x246cfd0>> ignored

Both could be resolved by using absolute paths for /assets/chromedriver and all other relative paths (e.g. logs)

I guess we should update instapy.py accordingly.

help wanted question

All 8 comments

Absolute path will break this in other OSes.

The error is pretty clear, just add the InstaPy path to your path variables before running the script (and you can call python quickstart.py)

(Also could happen when you ALREADY have chromedriver installed in another directory (/usr/bin)

Why would os.path.abspath break the script in other OS?

os.path.realpath with windows depending of the directory full path length will break.

It doesn't seems like a right way out, since every binary on python scripts on the web that runs via cronjob or another automation system needs to be on PATH variable.
Take another look on the error, see the message, chromedriver itselfs says that it needs to be on PATH.

So, how would I do this in CentOS?

If this is a necessary step, we should add it in the how to guides, too I鈥檇 think.

Absolute path is not good...
The cronjob simply starts a new command line session, so the solution to this to to use this as the command to Ben executed...

```
cd /home/InstaPy && python3.5 QuickStart.py

Yeah, I鈥檓 using this already in my crontab (copied from #46).

What would be your solution to keep InstaPy running on the server when you aren鈥檛 connected anymore via SSH? At the moment InstaPy stops then, so command on command-line was my try to solve this.

@tibor That's not a InstaPy related Issue...

I also tried that, but couldn't find a working solution. But I need to mention that I did not try out the given tools to only start the script on the machine. I don't know what they were called anymore...

Also, the cd /home/InstaPy && python3.5 QuickStart.py one works... I'm using that for nearly 5 months now

Use nohup before calling the script.

Use export PATH=/Path/to/instapy:$PATH to add the instapy folder to the PATH variable BEFORE running the script.

Also, read your distro documentation for basic knowledge of background service/tasks, since @timgrossmann said "That's not a InstaPy related Issue..."

Was this page helpful?
0 / 5 - 0 ratings

Related issues

converge picture converge  路  3Comments

seuraltimez picture seuraltimez  路  3Comments

neomh picture neomh  路  3Comments

ediooo picture ediooo  路  3Comments

n0sw34r picture n0sw34r  路  3Comments