how to use envoy package in python? - python-2.7

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')

Related

ERAlchemy cannot connect to database

I don't understand the syntax to call the render feature of ERAlchemy (https://pypi.org/project/ERAlchemy see "Usage for Python"). I am using Python 2.7, sqlite3, and PyCharm. I have ERAlchemy, GraphViz, and PyGraphViz installed.
I am trying the following, but it cannot connect to the database:
from eralchemy import render_er
render_er("sqlite:///C:\\Users\\myname\\Documents\\Work\\pythonsqlite.db", 'erd_from_sqlite.png')
And this is the error:
Traceback (most recent call last):
File "C:/Users/myname/Documents/Work/_sql_functions_rev0.py", line 81, in <module>
render_er("sqlite:///C:\\Users\\myname\\Documents\\Work\\pythonsqlite.db", 'erd_from_sqlite.png')
File "C:\Python27\ArcGISx6410.6\lib\site-packages\eralchemy\main.py", line 236, in render_er
intermediary_to_output(tables, relationships, output)
File "C:\Python27\ArcGISx6410.6\lib\site-packages\eralchemy\main.py", line 75, in intermediary_to_schema
graph.draw(path=output, prog='dot', format=extension)
File "C:\Python27\ArcGISx6410.6\lib\site-packages\pygraphviz\agraph.py", line 1474, in draw
data = self._run_prog(prog, args)
File "C:\Python27\ArcGISx6410.6\lib\site-packages\pygraphviz\agraph.py", line 1308, in _run_prog
runprog = r'"%s"' % self._get_prog(prog)
File "C:\Python27\ArcGISx6410.6\lib\site-packages\pygraphviz\agraph.py", line 1295, in _get_prog
raise ValueError("Program %s not found in path." % prog)
ValueError: Program dot not found in path.
Ah! Found the answer here
had to find the folder with "dot.exe" and add it to the environment variables -> system variables -> path

ConfigParser.NoSectionError: No section: 'main'

I installed habo malware hunter, but when i ran it,i got following errors:
habo#habo-VirtualBox:~/HaboMalHunter$ sudo python AnalyzeControl.py -z -l ./test_0813.zip Traceback (most recent call last):
File "AnalyzeControl.py", line 688, in <module>
ret = main(len(sys.argv), sys.argv)
File "AnalyzeControl.py", line 615, in main
cfg = init_arguments(argv)
File "AnalyzeControl.py", line 156, in init_arguments
cfg = init_cfg(args.config_path,args)
File "AnalyzeControl.py", line 96, in init_cfg
for k,v in conf_parser.items(SECTION_DEF):
File "/usr/lib/python2.7/ConfigParser.py", line 642, in items
raise NoSectionError(section)
ConfigParser.NoSectionError: No section: 'main'

Python 2.7.12, trying to build an executable file using pyinstaller. I keep getting the below error

Trying to build an executable file using pyinstaller. I keep getting the below error
Traceback (most recent call last):
File "Inventory_Computation\app.py", line 145, in <module>
File "flask\app.py", line 843, in run
File "werkzeug\serving.py", line 692, in run_simple
File "werkzeug\_reloader.py", line 248, in run_with_reloader
File "werkzeug\_reloader.py", line 129, in run
File "werkzeug\_reloader.py", line 22, in _iter_module_files
File "Lib\email\__init__.py", line 79, in __getattr__
ImportError: No module named message
Failed to execute script app
found the solution finally...
Go to "C:\Python27\Lib\email"
And find the "init.py"
Comment out below lines.
'Audio',
'Base',
'Image',
'Message',
'Multipart',
'NonMultipart',
'Text',
Try pyinstaller again

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

Attempting to use BrowserMobProxy with Selenium, getting permission denied error

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")