I have these python scripts which are dependent on each other --
py_scripts\format py_scripts\plugins py_scripts\utils py_scripts_main_.py py_scripts_pycache_ py_scripts\format\bit.py py_scripts\format\cmd.py py_scripts\format\ctr.py py_scripts\format\fnt.py py_scripts\format\hmp.py py_scripts\format\lmp.py py_scripts\format\mef.py py_scripts\format\qvm py_scripts\format\tex.py py_scripts\format\tga.py py_scripts\format\thm.py py_scripts\format\tlm.py py_scripts\format\tmm.py py_scripts\format\wav.py py_scripts\format_pycache_ py_scripts\format\qvm\op5.py py_scripts\format\qvm\op7.py py_scripts\format\qvm\ops.py py_scripts\format\qvm_init_.py py_scripts\format\qvm_pycache_ py_scripts\format\qvm_pycache_\op5.cpython-36.pyc py_scripts\format\qvm_pycache_\op7.cpython-36.pyc py_scripts\format\qvm_pycache_\ops.cpython-36.pyc py_scripts\format\qvm_pycache__init_.cpython-36.pyc py_scripts\format_pycache_\bit.cpython-36.pyc py_scripts\format_pycache_\cmd.cpython-36.pyc py_scripts\format_pycache_\ctr.cpython-36.pyc py_scripts\format_pycache_\fnt.cpython-36.pyc py_scripts\format_pycache_\hmp.cpython-36.pyc py_scripts\format_pycache_\lmp.cpython-36.pyc py_scripts\format_pycache_\mef.cpython-36.pyc py_scripts\format_pycache_\tex.cpython-36.pyc py_scripts\format_pycache_\tga.cpython-36.pyc py_scripts\format_pycache_\thm.cpython-36.pyc py_scripts\format_pycache_\tlm.cpython-36.pyc py_scripts\format_pycache_\tmm.cpython-36.pyc py_scripts\format_pycache_\wav.cpython-36.pyc py_scripts\plugins\bit py_scripts\plugins\cmd py_scripts\plugins\filesys py_scripts\plugins\fnt py_scripts\plugins\hmp py_scripts\plugins\ilff py_scripts\plugins\level py_scripts\plugins\lmp py_scripts\plugins\mef py_scripts\plugins\qvm py_scripts\plugins\tex py_scripts\plugins\thm py_scripts\plugins\tlm py_scripts\plugins\tmm py_scripts\plugins\wav py_scripts\plugins\bit\convert.py py_scripts\plugins\bit_init_.py py_scripts\plugins\bit_pycache_ py_scripts\plugins\bit_pycache_\convert.cpython-36.pyc py_scripts\plugins\bit_pycache__init_.cpython-36.pyc py_scripts\plugins\cmd\check.py py_scripts\plugins\cmd_init_.py py_scripts\plugins\cmd_pycache_ py_scripts\plugins\cmd_pycache_\check.cpython-36.pyc py_scripts\plugins\cmd_pycache__init_.cpython-36.pyc py_scripts\plugins\filesys\compfiles.py py_scripts\plugins\filesys\copyfiles.py py_scripts\plugins\filesys\countexts.py py_scripts\plugins\filesys\listfiles.py py_scripts\plugins\filesys\treefiles.py py_scripts\plugins\filesys_init_.py py_scripts\plugins\filesys_pycache_ py_scripts\plugins\filesys_pycache_\compfiles.cpython-36.pyc py_scripts\plugins\filesys_pycache_\copyfiles.cpython-36.pyc py_scripts\plugins\filesys_pycache_\countexts.cpython-36.pyc py_scripts\plugins\filesys_pycache_\listfiles.cpython-36.pyc py_scripts\plugins\filesys_pycache_\treefiles.cpython-36.pyc py_scripts\plugins\filesys_pycache__init_.cpython-36.pyc py_scripts\plugins\fnt\check.py py_scripts\plugins\fnt_init_.py py_scripts\plugins\fnt_pycache_ py_scripts\plugins\fnt_pycache_\check.cpython-36.pyc py_scripts\plugins\fnt_pycache__init_.cpython-36.pyc py_scripts\plugins\hmp\convert.py py_scripts\plugins\hmp_init_.py py_scripts\plugins\hmp_pycache_ py_scripts\plugins\hmp_pycache_\convert.cpython-36.pyc py_scripts\plugins\hmp_pycache__init_.cpython-36.pyc py_scripts\plugins\ilff\chunkset.py py_scripts\plugins\ilff\chunksizegcd.py py_scripts\plugins\ilff\chunksizeset.py py_scripts\plugins\ilff_init_.py py_scripts\plugins\ilff_pycache_ py_scripts\plugins\ilff_pycache_\chunkset.cpython-36.pyc py_scripts\plugins\ilff_pycache_\chunksizegcd.cpython-36.pyc py_scripts\plugins\ilff_pycache_\chunksizeset.cpython-36.pyc py_scripts\plugins\ilff_pycache__init_.cpython-36.pyc py_scripts\plugins\level\terrain.py py_scripts\plugins\level_init_.py py_scripts\plugins\level_pycache_ py_scripts\plugins\level_pycache_\terrain.cpython-36.pyc py_scripts\plugins\level_pycache__init_.cpython-36.pyc py_scripts\plugins\lmp\convert.py py_scripts\plugins\lmp_init_.py py_scripts\plugins\lmp_pycache_ py_scripts\plugins\lmp_pycache_\convert.cpython-36.pyc py_scripts\plugins\lmp_pycache__init_.cpython-36.pyc py_scripts\plugins\mef\check.py py_scripts\plugins\mef_init_.py py_scripts\plugins\mef_pycache_ py_scripts\plugins\mef_pycache_\check.cpython-36.pyc py_scripts\plugins\mef_pycache__init_.cpython-36.pyc py_scripts\plugins\qvm\ast.py py_scripts\plugins\qvm\convert.py py_scripts\plugins\qvm\decompile.py py_scripts\plugins\qvm\obj.py py_scripts\plugins\qvm\objects.py py_scripts\plugins\qvm\qsc.py py_scripts\plugins\qvm\terrain.py py_scripts\plugins\qvm_init_.py py_scripts\plugins\qvm_pycache_ py_scripts\plugins\qvm_pycache_\ast.cpython-36.pyc py_scripts\plugins\qvm_pycache_\convert.cpython-36.pyc py_scripts\plugins\qvm_pycache_\decompile.cpython-36.pyc py_scripts\plugins\qvm_pycache_\obj.cpython-36.pyc py_scripts\plugins\qvm_pycache_\objects.cpython-36.pyc py_scripts\plugins\qvm_pycache_\qsc.cpython-36.pyc py_scripts\plugins\qvm_pycache_\terrain.cpython-36.pyc py_scripts\plugins\qvm_pycache__init_.cpython-36.pyc py_scripts\plugins\tex\convert.py py_scripts\plugins\tex_init_.py py_scripts\plugins\tex_pycache_ py_scripts\plugins\tex_pycache_\convert.cpython-36.pyc py_scripts\plugins\tex_pycache__init_.cpython-36.pyc py_scripts\plugins\thm\convert.py py_scripts\plugins\thm_init_.py py_scripts\plugins\thm_pycache_ py_scripts\plugins\thm_pycache_\convert.cpython-36.pyc py_scripts\plugins\thm_pycache__init_.cpython-36.pyc py_scripts\plugins\tlm\convert.py py_scripts\plugins\tlm_init_.py py_scripts\plugins\tlm_pycache_ py_scripts\plugins\tlm_pycache_\convert.cpython-36.pyc py_scripts\plugins\tlm_pycache__init_.cpython-36.pyc py_scripts\plugins\tmm\convert.py py_scripts\plugins\tmm_init_.py py_scripts\plugins\tmm_pycache_ py_scripts\plugins\tmm_pycache_\convert.cpython-36.pyc py_scripts\plugins\tmm_pycache__init_.cpython-36.pyc py_scripts\plugins\wav\convert.py py_scripts\plugins\wav_init_.py py_scripts\plugins\wav_pycache_ py_scripts\plugins\wav_pycache_\convert.cpython-36.pyc py_scripts\plugins\wav_pycache__init_.cpython-36.pyc py_scripts\utils\fs.py py_scripts\utils\ilff.py py_scripts\utils_pycache_ py_scripts\utils_pycache_\fs.cpython-36.pyc py_scripts\utils_pycache_\ilff.cpython-36.pyc py_scripts_pycache__main_.cpython-36.pyc
I want to compile all these to a single exe file that works well with parameters...
Can anyone please help me ?
Thanks
My research :
i downloaded 'pyinstaller' from command line using 'pip' , then i used 'cd' command to locate my scripts folder , then i used 'pyinstaller --onefile main.py' command from command line and then it converted it to .exe
But the exe located in now 'dist' directory is showing an error on running error message
error output at command line
About my python scripts :
my scripts are actually dependent on 2 more external libraries "numpy, pillow, lxml", the 'main.py' used other scripts to work well. Also i wanted to pack all the file ".py, .pyc etc..." to exe. My script works well with parameters and is responsible for converting files. I don't wanted others to use my script it contains very sensitive data.
After all these info can anyone please help me ?
Thanks again
You can use pyinstaller for creating a single exe file which would be executable.
https://datatofish.com/executable-pyinstaller/
I think this would be helpful.
Related
Every time I run any python script (.py) in my Cygwin (bash) shell, I get a huge list of profling: ... :Skip. I don't think it's Cygwin-related, but something with my Python setup, which is installed from the official Cygwin repos & builds.
Python itself is functioning correctly but these messages clutter my output.
How can I fix/remove them?
[admin#Zbook ~/Desktop]λ python3.8 --version
Python 3.8.2
profiling:/usr/local/src/Python-3.8.2/Programs/python.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/getbuildinfo.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Parser/acceler.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Parser/grammar1.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Parser/listnode.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Parser/node.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Parser/parser.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Parser/token.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Parser/myreadline.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Parser/parsetok.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Parser/tokenizer.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/abstract.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/accu.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/boolobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/bytes_methods.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/bytearrayobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/bytesobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/call.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/capsule.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/cellobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/classobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/codeobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/complexobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/descrobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/enumobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/exceptions.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/genobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/fileobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/floatobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/frameobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/funcobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/interpreteridobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/iterobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/listobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/longobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/dictobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/odictobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/memoryobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/methodobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/moduleobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/namespaceobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/object.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/obmalloc.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/picklebufobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/rangeobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/setobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/sliceobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/structseq.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/tupleobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/typeobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/unicodeobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/unicodectype.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Objects/weakrefobject.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/_warnings.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/Python-ast.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/asdl.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/ast.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/ast_opt.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/ast_unparse.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/bltinmodule.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/ceval.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/codecs.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/compile.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/context.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/errors.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/frozenmain.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/future.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/getargs.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/getcompiler.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/getcopyright.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/getplatform.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/getversion.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/hamt.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/import.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/importdl.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/initconfig.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/marshal.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/modsupport.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/mysnprintf.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/mystrtoul.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/pathconfig.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/peephole.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/preconfig.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/pyarena.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/pyfpe.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/pyhash.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/pylifecycle.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/pymath.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/pystate.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/pythonrun.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/pytime.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/bootstrap_hash.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/structmember.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/symtable.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/sysmodule.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/thread.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/traceback.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/getopt.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/pystrcmp.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/pystrtod.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/pystrhex.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/dtoa.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/formatter_unicode.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/fileutils.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Python/dynload_shlib.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/getpath.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/main.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/gcmodule.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/posixmodule.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/errnomodule.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/pwdmodule.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/_sre.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/_codecsmodule.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/_weakref.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/_functoolsmodule.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/_operator.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/_collectionsmodule.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/_abc.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/itertoolsmodule.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/atexitmodule.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/signalmodule.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/_stat.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/timemodule.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/_threadmodule.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/_localemodule.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/_iomodule.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/iobase.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/fileio.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/bytesio.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/bufferedio.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/textio.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/stringio.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/faulthandler.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/_tracemalloc.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/hashtable.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/symtablemodule.gcda:Skip
profiling:/usr/local/src/Python-3.8.2/Modules/xxsubtype.gcda:Skip
#matzeri is right! Turns out I had an old & partial Python 3.8 installation which I compiled from source long ago and totally forgot about it!
Cited messages in the output are because of the --enable-optimizations and maybe the --disable-profiling compilation flags.
I used this bash script from Stack Exchange to clear this old compiled-from-source Python!
I have a web server with CGI script calling python scripts.
When i try to execute in a main file (test1.py) another script called via
os.system('/var/www/cgi-bin/readIRtemp.py '+arg1+' '+arg2+' '+arg3)
I get his error message in /var/log/apache2/error.log :
import: not found
from: can't read /var/mail/jinja2
this is understandable for me since when called directly from the python console my script works !
its content is:
import sys, os
from jinja2 import Environment, FileSystemLoader, select_autoescape
last20values=sys.argv[1]
currTempInDegreesCelcius=sys.argv[2]
print('test '+last20values+' '+currTempInDegreesCelcius)
env = Environment(
loader=FileSystemLoader('/var/www/html/templates'),
autoescape=select_autoescape(['html', 'xml'])
)
template = env.get_template('IR.html')
updatedTemplate=template.render( arrayOfTemp = last20values, currTemp=currTempInDegreesCelcius)
Html_file=open("/var/www/html/IR.html","w")
Html_file.write(updatedTemplate)
Html_file.close()
I read somewhere something like maybe when calling os.system() the script is running with a different user account or some crazy things like that ... please help!
of course i chmod 777 * everything but that doesnt help ...
I am trying to build ns-3 using the command ./waf inside the ns-3 folder,
but it gives me this:
Waf: Entering directory `/home/mptcp/build'
Waf: Leaving directory `/home/mptcp/build'
source not found: 'model/mp-tcp-onoff-application.cc' in
bld(features=['cxx', 'cxxshlib', 'ns3module'],
ns3_dir_location='src/applications', pcfilegen=bld(features='ns3pcfile',
idx=2, meths=[], prec=defaultdict(<type 'list'>, {}), _name='', source='',
module='ns3-applications', mappings={}, path=/home/mptcp/src/applications,
target='') in /home/mptcp/src/applications, use=['ns3-internet', 'ns3-
config-store', 'ns3-stats', 'ns3-mptcp'], mappings={}, uselib='', meths=
['_add_test_code', 'apply_bundle', 'process_rule', 'process_source',
'apply_link', 'apply_implib', 'process_use', 'propagate_uselib_vars',
'apply_incpaths', 'apply_vnum', 'set_macosx_deployment_target'],
prec=defaultdict(<type 'list'>, {}), source=['model/bulk-send-
application.cc', 'model/onoff-application.cc', 'model/packet-sink.cc',
'model/ping6.cc', 'model/radvd.cc', 'model/radvd-interface.cc',
'model/radvd-prefix.cc', 'model/udp-client.cc', 'model/udp-server.cc',
'model/seq-ts-header.cc', 'model/udp-trace-client.cc', 'model/packet-loss-
counter.cc', 'model/udp-echo-client.cc', 'model/udp-echo-server.cc',
'model/v4ping.cc', 'model/application-packet-probe.cc', 'helper/bulk-send-
helper.cc', 'helper/on-off-helper.cc', 'helper/packet-sink-helper.cc',
'helper/ping6-helper.cc', 'helper/udp-client-server-helper.cc',
'helper/udp-echo-helper.cc', 'helper/v4ping-helper.cc', 'helper/radvd-
helper.cc', 'model/mp-tcp-packet-sink.cc', 'model/mp-tcp-bulk-send-
application.cc', 'model/mp-tcp-onoff-application.cc', 'helper/mp-tcp-
packet-sink-helper.cc', 'helper/mp-tcp-bulk-send-helper.cc'], test=False,
is_ns3_module=True, install_path='${LIBDIR}', module_deps=['internet',
'config-store', 'stats', 'mptcp'], dependencies=['internet', 'config-
store', 'stats', 'mptcp'], path=/home/mptcp/src/applications, vnum=None,
posted=True, is_static=False, target='../../ns3.19-applications-debug',
idx=1, _name='ns3-applications') in /home/mptcp/src/applications
I cant figure out what to do.
I have removed the file /mp-tcp-onoff-application.cc from the folder and have also edited the wscript file.
How to remove this error ? This seems to be a missing source file error, what does the error message say ? I have already removed the file references.
The error says that waf can't find model/mp-tcp-onoff-application.cc. In the error message the source attribute of the task generator lists model/mp-tcp-onoff-application.cc as a source. waf is perfectly right :)
If you have removed model/mp-tcp-onoff-application.cc from disk you should ensure that your wscript does not consider model/mp-tcp-onoff-application.cc as a source. Without the wscript I can't help you more.
If the wscript build the source list, try to waf clean before your build
I found a way to run built in auto it functions from python using the following code
from win32com.client import Dispatch
Auto = Dispatch("AutoItX3.Control")
Auto.Run("notepad.exe", "", 5)
Is there a similar way to call custom methods i.e methods defined in my_AutoIt_File.au3
Say I have a method in this file
Func my_autoit_method
;some code
EndFunc
Is there a way to call this my_autoit_method from python?
From the help file:
AutoIt specific command Line Switches
Form1: AutoIt3.exe [/ErrorStdOut] [/AutoIt3ExecuteScript] file
[params ...]
Execute an AutoIt3 Script File
/ErrorStdOut Allows to redirect fatal error to StdOut which can be captured by an application as Scite editor. This switch can be used with a compiled script.
To execute a standard AutoIt Script File 'myscript.au3', use the command:
'AutoIt3.exe myscript.au3'
Form2: Compiled.exe [/ErrorStdOut] [params ...]
Execute an compiled AutoIt3 Script File produced with Aut2Exe.
Form3: Compiled.exe [/ErrorStdOut] [/AutoIt3ExecuteScript file]
[params ...]
Execute another script file from a compiled AutoIt3 Script File. Then you don't need to fileinstall another copy of AutoIT3.exe in your compiled file.
Form4: AutoIt3.exe [/ErrorStdOut] /AutoIt3ExecuteLine "command line"
Execute one line of code.
To execute a single line of code, use the command:
Run(#AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(0, ''Hello World!'', ''Hi!'')"')
You have to expose your AutoIt Function to other applications. This could be done easily with AutoItObject, which can register an object in the ROT.
The AutoIt Code would be:
#include <AutoItObject.au3>
$oObject = _AutoItObject_Create()
_AutoItObject_RegisterObject($oObject, 'MyVery.CustomApplication')
_AutoItObject_AddMethod($oObject, '_my_custom_function', '_my_custom_function')
While Sleep(100)
WEnd
Func _my_custom_function($oSelf)
MsgBox(0, '', 'AutoIt says Hi')
Exit
EndFunc
The Python Code should be:
from win32com.client import Dispatch
Auto = Dispatch("MyVery.CustomApplication")
Auto._my_custom_function()
I've looked all around Google and its archives. There are several good articles, but none seem to help me out. So I thought I'd come here for a more specific answer.
The Objective: I want to run this code on a website to get all the picture files at once. It'll save a lot of pointing and clicking.
I've got Python 2.3.5 on a Windows 7 x64 machine. It's installed in C:\Python23.
How do I get this script to "go", so to speak?
=====================================
WOW. 35k views. Seeing as how this is top result on Google, here's a useful link I found over the years:
http://learnpythonthehardway.org/book/ex1.html
For setup, see exercise 0.
=====================================
FYI: I've got zero experience with Python. Any advice would be appreciated.
As requested, here's the code I'm using:
"""
dumpimages.py
Downloads all the images on the supplied URL, and saves them to the
specified output file ("/test/" by default)
Usage:
python dumpimages.py http://example.com/ [output]
"""
from BeautifulSoup import BeautifulSoup as bs
import urlparse
from urllib2 import urlopen
from urllib import urlretrieve
import os
import sys
def main(url, out_folder="C:\asdf\"):
"""Downloads all the images at 'url' to /test/"""
soup = bs(urlopen(url))
parsed = list(urlparse.urlparse(url))
for image in soup.findAll("img"):
print "Image: %(src)s" % image
filename = image["src"].split("/")[-1]
parsed[2] = image["src"]
outpath = os.path.join(out_folder, filename)
if image["src"].lower().startswith("http"):
urlretrieve(image["src"], outpath)
else:
urlretrieve(urlparse.urlunparse(parsed), outpath)
def _usage():
print "usage: python dumpimages.py http://example.com [outpath]"
if __name__ == "__main__":
url = sys.argv[-1]
out_folder = "/test/"
if not url.lower().startswith("http"):
out_folder = sys.argv[-1]
url = sys.argv[-2]
if not url.lower().startswith("http"):
_usage()
sys.exit(-1)
main(url, out_folder)
On windows platform, you have 2 choices:
In a command line terminal, type
c:\python23\python xxxx.py
Open the python editor IDLE from the menu, and open xxxx.py, then press F5 to run it.
For your posted code, the error is at this line:
def main(url, out_folder="C:\asdf\"):
It should be:
def main(url, out_folder="C:\\asdf\\"):
Usually you can double click the .py file in Windows explorer to run it. If this doesn't work, you can create a batch file in the same directory with the following contents:
C:\python23\python YOURSCRIPTNAME.py
Then double click that batch file. Or, you can simply run that line in the command prompt while your working directory is the location of your script.
Since you seem to be on windows you can do this so python <filename.py>. Check that python's bin folder is in your PATH, or you can do c:\python23\bin\python <filename.py>. Python is an interpretive language and so you need the interpretor to run your file, much like you need java runtime to run a jar file.
use IDLE Editor {You may already have it} it has interactive shell for python and it will show you execution and result.
Your command should include the url parameter as stated in the script usage comments.
The main function has 2 parameters, url and out (which is set to a default value)
C:\python23\python "C:\PathToYourScript\SCRIPT.py" http://yoururl.com "C:\OptionalOutput\"
If you want to run .py files in Windows, Try installing Git bash
Then download python(Required Version) from python.org and install in the main c drive folder
For me, its :
"C:\Python38"
then open Git Bash and go to the respective folder where your .py file is stored :
For me, its :
File Location : "Downloads"
File Name : Train.py
So i changed my Current working Directory From "C:/User/(username)/" to "C:/User/(username)/Downloads"
then i will run the below command
" /c/Python38/python Train.py "
and it will run successfully.
But if it give the below error :
from sklearn.model_selection import train_test_split
ModuleNotFoundError: No module named 'sklearn'
Then Do not panic :
and use this command :
" /c/Python38/Scripts/pip install sklearn "
and after it has installed sklearn go back and run the previous command :
" /c/Python38/python Train.py "
and it will run successfully.
!!!!HAPPY LEARNING !!!!