Attempting to use BrowserMobProxy with Selenium, getting permission denied error - python-2.7

Here is the stacktrace:
Traceback (most recent call last):
File "facebook_scraper.py", line 185, in <module>
fb_scraper()
File "facebook_scraper.py", line 36, in fb_scraper
server.start()
File "build/bdist.linux-x86_64/egg/browsermobproxy/server.py", line 56, in start
File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1308, in _execute_child
raise child_exception
OSError: [Errno 13] Permission denied
I am following instructions from this page

Check that the user running the Python script has the permission to run the browsermob proxy batch file, that should be a .bat file found in path/to/browsermob-proxy
server = Server("path/to/browsermob-proxy")

Related

Unable to progress past signup due to media_root permission error

I'm attempting to signup for an account on my django site, but I'm running into the following error:
Thumbnail generation failed
Traceback (most recent call last):
File "C:\Users\jason\AppData\Local\Programs\Python\Python36\lib\site-packages\versatileimagefield\image_warmer.py", line 117, in _prewarm_versatileimagefield
url = get_url_from_image_key(versatileimagefieldfile, size_key)
File "C:\Users\jason\AppData\Local\Programs\Python\Python36\lib\site-packages\versatileimagefield\utils.py", line 216, in get_url_from_image_key
img_url = img_url[size_key].url
File "C:\Users\jason\AppData\Local\Programs\Python\Python36\lib\site-packages\versatileimagefield\datastructures\sizedimage.py", line 149, in __getitem__
height=height
File "C:\Users\jason\AppData\Local\Programs\Python\Python36\lib\site-packages\versatileimagefield\datastructures\sizedimage.py", line 201, in create_resized_image
path_to_image
File "C:\Users\jason\AppData\Local\Programs\Python\Python36\lib\site-packages\versatileimagefield\datastructures\base.py", line 140, in retrieve_image
image = self.storage.open(path_to_image, 'rb')
File "C:\Users\jason\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\files\storage.py", line 33, in open
return self._open(name, mode)
File "C:\Users\jason\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\files\storage.py", line 218, in _open
return File(open(self.path(name), mode))
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\jason\\Desktop\\staticfiles\\media_root'
I just reinstalled windows 10 while keeping personal files. This error never happened before reinstalling windows 10. I've looked at the folder permissions and can't see anything amiss. Any thoughts on what I can check?
Thanks!

IOError: [Errno 13] Permission denied: '/usr/local/lib/netscape/mime.types'

I am creating a virtual environment using mkvirtualenv, and I get this error, where have I gone wrong?
$ mkvirtualenv data
New python executable in /home/usman/.virtualenvs/data/bin/python
Installing setuptools, pip, wheel...
Complete output from command /home/usman/.virtualenvs/data/bin/python - setuptools pip wheel:
Collecting setuptools
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/commands/install.py", line 324, in run
requirement_set.prepare_files(finder)
File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/req/req_set.py", line 554, in _prepare_file
require_hashes
File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/req/req_install.py", line 278, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/index.py", line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/index.py", line 386, in find_all_candidates
self.find_links, expand_dir=True)
File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/index.py", line 236, in _sort_locations
sort_path(os.path.join(path, item))
File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/index.py", line 217, in sort_path
if mimetypes.guess_type(url, strict=False)[0] == 'text/html':
File "/usr/lib/python2.7/mimetypes.py", line 293, in guess_type
init()
File "/usr/lib/python2.7/mimetypes.py", line 358, in init
db.read(file)
File "/usr/lib/python2.7/mimetypes.py", line 202, in read
with open(filename) as fp:
IOError: [Errno 13] Permission denied: '/usr/local/lib/netscape/mime.types'
sudo chmod a+r /usr/local/lib/netscape/mime.types
This is probably because your file "mime.types" has not the sufficient permission status.
Use the chmod command as mentioned earlier.

error while auto downloading a report through selenium and python

I'm doing automation of a website and auto downloading a report through selenium and python and I get this error:
C:\Windows\system32>
C:\Python27\python.exeC:\Python27\Scripts\MH_Download3.py
Traceback (most recent call last):
File "C:\Python27\Scripts\MH_Download3.py", line 111, in <module>
driver = webdriver.Firefox(firefox_binary=binary)
File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 80, in __init__self.binary, timeout)
File`"C:\Python27\lib\sitepackages\selenium\webdriver\firefox\extension_connection.py", line 52, in __init__self.binary.launch_browser(self.profile, timeout=timeout)
File "C:\Python27\lib\sitepackages\selenium\webdriver\firefox\firefox_binary.py", line 67, in launch_browserself._start_from_profile_path(self.profile.path)
File "C:\Python27\lib\sitepackages\selenium\webdriver\firefox\firefox_binary.py", line 90, in _start_from_profile_path env=self._firefox_env)
File "C:\Python27\lib\subprocess.py", line 709, in __init__ errread, errwrite)
File "C:\Python27\lib\subprocess.py", line 957, in _execute_child startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

run storm nimbus get error

when i run storm nimbus or other storm command i get the same error
~/work/apache-storm-0.9.5/bin$ storm nimbus
Traceback (most recent call last): File "/home/libin/work/apache-storm-0.9.5/bin/storm", line 514, in <module>
main()
File "/home/libin/work/apache-storm-0.9.5/bin/storm", line 511, in main
(COMMANDS.get(COMMAND, unknown_command))(*ARGS)
File "/home/libin/work/apache-storm-0.9.5/bin/storm", line 308, in nimbus
jvmopts = parse_args(confvalue("nimbus.childopts", cppaths)) + [
File "/home/libin/work/apache-storm-0.9.5/bin/storm", line 113, in confvalue
p = sub.Popen(command, stdout=sub.PIPE)
File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
raise child_exception
edit: i modify my javahome as #helloV said,but get the same mistake
Check your JAVA_HOME. I had the same issue. My JAVA_HOME was pointing to a wrong dir. Once I set JAVA_HOME correctly, the problem went away.
echo $JAVA_HOME
> /usr/lib/jvm/jdk1.7.0_17

how to use envoy package in python?

I have installed package envoy. I ran the script but a windows error occured .I commented envoy.run then the full script runs but when I remove the comment, error occurs.
import envoy
# This data is checked-in to the repository and is a compressed
# version of the output from Example 3
F = 'resources/ch06-mailboxes/data/enron.mbox.json.bz2'
r = envoy.run("bunzip2 %s" % (F,))
print r.std_out
print r.std_err
traceback of script:
Exception in thread Thread-9:
Traceback (most recent call last):
File "C:\Users\sachin\Anaconda\lib\threading.py", line 810, in __bootstrap_inner
self.run()
File "C:\Users\sachin\Anaconda\lib\threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
File "C:\Users\sachin\Anaconda\lib\site-packages\envoy\core.py", line 40, in target
bufsize=0,
File "C:\Users\sachin\Anaconda\lib\subprocess.py", line 709, in __init__
errread, errwrite)
File "C:\Users\sachin\Anaconda\lib\subprocess.py", line 957, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
Please try this:
F = os.path.join(os.getcwd(), 'resources/ch06-mailboxes/data/enron.mbox.json.bz2')