Web programming Python powershell error - python

I'm new to python and I have just started web development. In the tutorial there is a page where I print out "hello world" using windows powershell. [But I have been keep getting this message and cannot access to local host :( please help me)
[error notice][1]
PS C:\Users\Administrator> python ‘C:\Program Files (x86)\Google\google_appengine\dev_appserver.py’ \Downloads\helloworld
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\dev_appserver.py", line 83, in <module>
_run_file(__file__, globals())
File "C:\Program Files (x86)\Google\google_appengine\dev_appserver.py", line 79, in _run_file
execfile(_PATHS.script_file(script_name), globals_)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\devappserver2.py", line 1040, in <module>
main()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\devappserver2.py", line 1033, in main
dev_server.start(options)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\devappserver2.py", line 758, in start
options.config_paths, options.app_id)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\application_configuration.py", line 831, in __init__
module_configuration = ModuleConfiguration(config_path, app_id)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\application_configuration.py", line 127, in __init__
self._config_path)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\application_configuration.py", line 423, in _parse_configuration
with open(configuration_path) as f:
IOError: [Errno 2] No such file or directory: '\\Downloads\\helloworld'
PS C:\Users\Administrator>

IOError: [Errno 2] No such file or directory: '\Downloads\helloworld'
1) \Downloads\helloworld folder exists?
2) are you using good path to folder?

Related

Kivy Python - getting "FileNotFoundError: [Errno 2] No such file or directory: 'unzip'"

I tried to create an APK file by using WSL and get this:
# Unpacking Android NDK
# Run ['unzip', '-q', '/home/tarpetos/.buildozer/android/platform/android-ndk-r23b-linux.zip']
# Cwd /home/tarpetos/.buildozer/android/platform
Traceback (most recent call last):
File "/usr/local/bin/buildozer", line 11, in <module>
load_entry_point('buildozer==1.4.1.dev0', 'console_scripts', 'buildozer')()
File "/usr/local/lib/python3.8/dist-packages/buildozer-1.4.1.dev0-py3.8.egg/buildozer/scripts/client.py", line 13, in main
Buildozer().run_command(sys.argv[1:])
File "/usr/local/lib/python3.8/dist-packages/buildozer-1.4.1.dev0-py3.8.egg/buildozer/__init__.py", line 1024, in run_command
self.target.run_commands(args)
File "/usr/local/lib/python3.8/dist-packages/buildozer-1.4.1.dev0-py3.8.egg/buildozer/target.py", line 93, in run_commands
func(args)
File "/usr/local/lib/python3.8/dist-packages/buildozer-1.4.1.dev0-py3.8.egg/buildozer/target.py", line 103, in cmd_debug
self.buildozer.prepare_for_build()
File "/usr/local/lib/python3.8/dist-packages/buildozer-1.4.1.dev0-py3.8.egg/buildozer/__init__.py", line 172, in prepare_for_build
self.target.install_platform()
File "/usr/local/lib/python3.8/dist-packages/buildozer-1.4.1.dev0-py3.8.egg/buildozer/targets/android.py", line 701, in install_platform
self._install_android_ndk()
File "/usr/local/lib/python3.8/dist-packages/buildozer-1.4.1.dev0-py3.8.egg/buildozer/targets/android.py", line 497, in _install_android_ndk
self.buildozer.file_extract(archive,
File "/usr/local/lib/python3.8/dist-packages/buildozer-1.4.1.dev0-py3.8.egg/buildozer/__init__.py", line 616, in file_extract
self.cmd(["unzip", "-q", join(cwd, archive)], cwd=cwd)
File "/usr/local/lib/python3.8/dist-packages/buildozer-1.4.1.dev0-py3.8.egg/buildozer/__init__.py", line 289, in cmd
process = Popen(command, **kwargs)
File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'unzip'
I have a main.py file and a connection_voice.ogg file in the same directory and at first I thought the problem was connecting the audio file. But now I understand that the problem is not in the audio file.
music = SoundLoader.load('connection_voice.ogg')
if music:
music.play()
And I don't understand what an 'unzip' file or directory is. Please give some advice
So, to solve this you need to enter to terminal sudo apt-get install unzip. And than this problem will be solved.

How to install npm modules using a python script in the directory where my script is located

The file structure should look like :
test.py
node_modules (The folder containing installed npm modules)
I have tried this :
import subprocess
import os
dir_path = os.path.dirname(os.path.realpath(__file__)) #holds the directory where python script is located
directory where python script is located
os.chdir(dir_path)
subprocess.call(["npm","init"])
subprocess.call(["npm","install"])
Error :
Traceback (most recent call last):
File "c:\Users\Alifreeze.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\ptvsd_launcher.py", line 43, in
main(ptvsdArgs)
File "c:\Users\Alifreeze.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\lib\python\old_ptvsd\ptvsd__main__.py", line 432, in main
run()
File "c:\Users\Alifreeze.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\lib\python\old_ptvsd\ptvsd__main__.py", line 316, in run_file
runpy.run_path(target, run_name='main')
File "C:\Users\Alifreeze\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
File "C:\Users\Alifreeze\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "C:\Users\Alifreeze\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "c:\Users\Alifreeze\Desktop\ShellScripts\npm.py", line 6, in
subprocess.call(["npm","init"])
File "C:\Users\Alifreeze\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 323, in call
with Popen(*popenargs, **kwargs) as p:
File "C:\Users\Alifreeze\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 775, in init
restore_signals, start_new_session)
File "C:\Users\Alifreeze\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 1178, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
import subprocess
subprocess.call(["npm","init"])
subprocess.call(["npm","install"])
try this code in the test.py script, package.json should be present in the same folder while running the python script
This worked for me!
import subprocess
import os
dir_path = os.path.dirname(os.path.realpath(__file__)) #holds the directory where python script is located
os.chdir(dir_path)
subprocess.check_call('npm init', shell=True)

streamlit installation error on windows 7 64 bit

I run pip install streamlit and succesfully install streamlit.
However, when I run streamlit hello or streamlit run app.py where app.py is a python app where I import streamlit, I get the following error.
$ streamlit hello
Traceback (most recent call last):
File "c:\program files (x86)\python37-32\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\program files (x86)\python37-32\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Program Files (x86)\Python37-32\Scripts\streamlit.exe\__main__.py", line 7, in <module>
File "c:\program files (x86)\python37-32\lib\site-packages\click\core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "c:\program files (x86)\python37-32\lib\site-packages\click\core.py", line 717, in main
rv = self.invoke(ctx)
File "c:\program files (x86)\python37-32\lib\site-packages\click\core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\program files (x86)\python37-32\lib\site-packages\click\core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\program files (x86)\python37-32\lib\site-packages\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "c:\program files (x86)\python37-32\lib\site-packages\streamlit\cli.py", line 192, in main_hello
_main_run(filename)
File "c:\program files (x86)\python37-32\lib\site-packages\streamlit\cli.py", line 251, in _main_run
bootstrap.run(file, command_line, args)
File "c:\program files (x86)\python37-32\lib\site-packages\streamlit\bootstrap.py", line 221, in run
server.start(_on_server_start)
File "c:\program files (x86)\python37-32\lib\site-packages\streamlit\server\Server.py", line 213, in start
start_listening(app)
File "c:\program files (x86)\python37-32\lib\site-packages\streamlit\server\Server.py", line 122, in start_listening
app.listen(port)
File "c:\program files (x86)\python37-32\lib\site-packages\tornado\web.py", line 2042, in listen
server.listen(port, address)
File "c:\program files (x86)\python37-32\lib\site-packages\tornado\tcpserver.py", line 143, in listen
sockets = bind_sockets(port, address=address)
File "c:\program files (x86)\python37-32\lib\site-packages\tornado\netutil.py", line 168, in bind_sockets
sock.bind(sockaddr)
OSError: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions
I have tried to disable firewall but still got the error persists. I have also tried running streamlit run app.py --browser.serverPort 3000 and still got the same error.
I think the option is not --browser.serverPort but --server.port:
streamlit run your_script.py --server.port 3000

TypeError when installing jupyter in windows10 OS

When I installing Jupyter notebook in my Windows10 OS, but I catched TypeError, and I don't have Anaconda, I just install it via pip in my cmd window, the description following,
Exception:
Traceback (most recent call last):
File "c:\program files\python36\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "c:\program files\python36\lib\site-packages\pip\commands\install.py", line 324, in run
requirement_set.prepare_files(finder)
File "c:\program files\python36\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "c:\program files\python36\lib\site-packages\pip\req\req_set.py", line 666, in _prepare_file
check_dist_requires_python(dist)
File "c:\program files\python36\lib\site-packages\pip\utils\packaging.py", line 48, in check_dist_requires_python
feed_parser.feed(metadata)
File "c:\program files\python36\lib\email\feedparser.py", line 175, in feed
self._input.push(data)
File "c:\program files\python36\lib\email\feedparser.py", line 103, in push
self._partial.write(data)
TypeError: string argument expected, got 'NoneType'
There were no solution in Google, who can help me please?

ViM-LaTeX, python, and Mac OS 10.8.1 and a weird error

I just updated my machine to Mountain Lion (10.8.1) and am trying to install vim-latex. I have used the suite daily for about 5 years now, but when trying to do a clean install and opening up a .tex file I get the following error message.
"UnitCircleAnalysis.tex" 118L, 4154CTraceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 565,
in File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 547,
in main File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 278,
in addusersitepackages File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 253,
in getusersitepackages File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 243,
in getuserbase File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 523,
in get_config_var File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 419,
in get_config_vars File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 298,
in _init_posix IOError: invalid Python installation: unable to open /usr/include/python2.7/pyconfig.h (No such file or directory)
This appears to be a problem with the Python implementation. Are there any suggestions how to fix this?

Categories