Im learning Python.
Getting below exception while trying to clone a repos
Traceback (most recent call last):
File "C:\Users\Selvakumar\AppData\Local\Programs\Python\Python36-32\lib\site-packages\git\cmd.py", line 622, in execute
**subprocess_kwargs
File "C:\Users\Selvakumar\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 969, in __init__
restore_signals, start_new_session)
File "C:\Users\Selvakumar\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 1249, in _execute_child
startupinfo)
PermissionError: [WinError 5] Access is denied
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "config_console.py", line 2185, in <module>
command_line = ConfigCommandLine()
File "config_console.py", line 87, in __init__
g.clone('git#github.com:Modria/Ecomm_GM.git')
File "C:\Users\Selvakumar\AppData\Local\Programs\Python\Python36-32\lib\site-packages\git\cmd.py", line 463, in <lambda>
return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
File "C:\Users\Selvakumar\AppData\Local\Programs\Python\Python36-32\lib\site-packages\git\cmd.py", line 905, in _call_process
return self.execute(make_call(), **_kwargs)
File "C:\Users\Selvakumar\AppData\Local\Programs\Python\Python36-32\lib\site-packages\git\cmd.py", line 625, in execute
raise GitCommandNotFound(str(err))
git.exc.GitCommandNotFound: [WinError 5] Access is denied
GitPython is installed. ssh keys are available in C:\Users\Selvakumar.ssh and its working when I clone from git bash. But the same not working from python. Please note that ssh keys are generated with no password. Please help me to resolve it
The OP confirms it is a PATH/variable issue
Does your PATH references git binary?
Yes, that was the mistake I did. I missed to git.exe in GIT_PYTHON_GIT_EXECUTABLE path variable.
Given like this as C:\Program Files (x86)\Git\bin\git.exe and it works.
You can see that variable introduced here in GitPython 26
If set, it should contain the full path to the git executable, e.g. c:\Program Files (x86)\Git\bin\git.exe on windows or /usr/bin/git on linux.
The GitPyhton README states:
GitPython needs the git executable to be installed on the system and available in your PATH for most operations.
If it is not in your PATH, you can help GitPython find it by setting the GIT_PYTHON_GIT_EXECUTABLE=<path/to/git> environment variable.
seems like an authority error, be sure to run your script as an administrator
Related
When running either command:
sudo serverless package or sudo serverless deploy
I get the following traceback:
Error: ERROR: Exception: Traceback (most recent call last): File
“/var/lang/lib/python3.6/shutil.py”, line 550, in move os.rename(src,
real_dst) OSError: [Errno 18] Invalid cross-device link:
‘/tmp/pip-target-wqc5grcw/lib/python/setuptools’ ->
‘/var/task/setuptools’
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
“/var/lang/lib/python3.6/site-packages/pip/_internal/cli/base_command.py”,
line 228, in _main status = self.run(options, args) File
“/var/lang/lib/python3.6/site-packages/pip/_internal/cli/req_command.py”,
line 182, in wrapper return func(self, options, args) File
“/var/lang/lib/python3.6/site-packages/pip/_internal/commands/install.py”,
line 456, in run options.target_dir, target_temp_dir, options.upgrade
File
“/var/lang/lib/python3.6/site-packages/pip/_internal/commands/install.py”,
line 514, in _handle_target_dir target_item_dir File
“/var/lang/lib/python3.6/shutil.py”, line 561, in move symlinks=True)
File “/var/lang/lib/python3.6/shutil.py”, line 321, in copytree
os.makedirs(dst) File “/var/lang/lib/python3.6/os.py”, line 220, in
makedirs mkdir(name, mode) PermissionError: [Errno 13] Permission
denied: ‘/var/task/setuptools’
I’ve created several different projects and they work locally but they never progress beyond this invalid cross-link device Error when trying to deploy or package.
What are my options?
Edit: I tried nuking my virtualenv, uninstalling/re-installing serverless-python-requirements, deleting/re-pulling the lambci/lambda Docker image, no dice.
Then, I stumbled on this GH issue. As hinted in it, the experimental Docker feature Use gRPC FUSE for file sharing seems to be the cause. I've switched it off in the Docker Preferences for now and deploys are successful.
I just had a similar problem. See this issue for a possible solution.
In summary,
Remove all cached packages in /Library/Caches/serverless-python-requirements/
Remove existing docker image lambci/lambda build-python3.8
I have installed exiftool (https://smarnach.github.io/pyexiftool/) and I am able to import the library, but I get the following error when trying to run the test data just to see if it works.
ERROR: test_get_metadata (__main__.TestExifTool)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Program Files\Python36\Lib\site-
packages\pyexiftool\test\test_exiftool.py", line 66, in test_get_metadata
with self.et:
File "C:\Program Files\Python36\lib\site-packages\exiftool.py", line 191, in __enter__
self.start()
File "C:\Program Files\Python36\lib\site-packages\exiftool.py", line 174, in start
stderr=devnull)
File "C:\Program Files\Python36\lib\subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "C:\Program Files\Python36\lib\subprocess.py", line 997, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
I also did run the setup code that is in the exiftool folder and still no luck. I think it might be a library issue or path or the (init.py) file, but I've tried several ways and so I'm here to ask if anyone else has a solution or ideas for me to try and fix it.
I'm running Python 3.6.6 and have tried other versions.
(I can run exiftool in command line, but I have encoded BASE64 images that exiftool doesnt work in command line to fully decode.)
Thank you StarGeek! The problem was that I didn't have the exiftool command tool (the separate application of exiftool) in the right PATH env variable. Once I added the application to the PATH env variables i got it to work. Also in the python exiftool code at line 70 it says that you have to have it in the path or direct it to the executable, that I had missed. Thanks again!
I am simply testing how to call external .py files from one .py file.
I have 2 .py files, both in the same directory. Here is the code for the main one (runext.py suppose to call ext.py):
import subprocess
subprocess.call("/Users/training/PycharmProjects/MarcouFirstProject/ext.py")
ext.py is just print("hey this actually worked")
However, every time I run runext.py, I get this error message:
Traceback (most recent call last):
File "/Users/training/PycharmProjects/MarcouFirstProject/runext.py", line 2, in <module>
subprocess.call("/Users/training/PycharmProjects/MarcouFirstProject/ext.py")
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 557, in call
with Popen(*popenargs, **kwargs) as p:
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg)
PermissionError: [Errno 13] Permission denied
I don't know why it denies permission. This is on a school computer (I'm in a programming class) if that helps.
Thanks.
You don't have the permissions to execute the file /Users/training/PycharmProjects/MarcouFirstProject/ext.py
You can add the permission +x by using chmod:
chmod +x /Users/training/PycharmProjects/MarcouFirstProject/ext.py
Or, you can use python explicitly:
import subprocess
subprocess.call("python /Users/training/PycharmProjects/MarcouFirstProject/ext.py")
I am very new to Python and Django and is currently busy learning myself through tutorials on www.djangoproject.com. I am using PyCharm and working on OS X El Capitan. I have imported a project from GitHub and created a virtual environment for the project interpreter based on Python 3.5.1. In the vm I installed django.
I then activated the vm.
Now.. I started by trying to execute simple commands in the terminal like python manage.py startapp deonapp and python manage.py runserver but each time I get an error which I pasted below.. What did I miss? I cannot seem to find the /log/ directory?
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/logging/config.py", line 558, in configure
handler = self.configure_handler(handlers[name])
File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/logging/config.py", line 731, in configure_handler
result = factory(**kwargs)
File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/logging/__init__.py", line 1008, in __init__
StreamHandler.__init__(self, self._open())
File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/logging/__init__.py", line 1037, in _open
return open(self.baseFilename, self.mode, encoding=self.encoding)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/deon/Documents/PyCharmProjects/Developments/deonproject/log/debug.log'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/deon/Documents/PyCharmProjects/Developments/deonproject/venv/lib/python3.5/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/Users/deon/Documents/PyCharmProjects/Developments/deonproject/venv/lib/python3.5/site-packages/django/core/management/__init__.py", line 341, in execute
django.setup()
File "/Users/deon/Documents/PyCharmProjects/Developments/deonproject/venv/lib/python3.5/site-packages/django/__init__.py", line 22, in setup
configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
File "/Users/deon/Documents/PyCharmProjects/Developments/deonproject/venv/lib/python3.5/site-packages/django/utils/log.py", line 75, in configure_logging
logging_config_func(logging_settings)
File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/logging/config.py", line 795, in dictConfig
dictConfigClass(config).configure()
File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/logging/config.py", line 566, in configure
'%r: %s' % (name, e))
ValueError: Unable to configure handler 'file': [Errno 2] No such file or directory: '/Users/deon/Documents/PyCharmProjects/Developments/deonproject/log/debug.log'
I managed to fix it. The log directory was not created because it was excluded in the .gitignore file. I completely forgot to look what was excluded :). I created the directory manually and now it passed the error.
Deon
you can add this in setting.py
LOG_PATH = os.path.join(BASE_DIR, 'log')
or
if not os.path.join(LOG_PATH):
os.mkdir(LOG_PATH)
Other answers can be true in most of cases, But In my case log directory was created, But log dir had permission issue to my user. simply using chown to my user (my case www-data) solved the problem.
(In my case):
sudo chown www-data:www-data /var/log/django/
use your username:user-group instead of www-data:www-data and your log dir instead of /var/log/django/.
Traceback says, that it's no "log" directory.
Create directory with name log in path /Users/deon/Documents/PyCharmProjects/Developments/deonproject/
Create empty file .gitkeep
After creating .gitkeep file, push it to GitHub
I see the following error in the log file:
Exception in thread Thread-1:
Traceback (most recent call last):
File "threading.pyc", line 486, in __bootstrap_inner
File "launcher\taskthread.pyc", line 65, in run
File "subprocess.pyc", line 594, in __init__
File "subprocess.pyc", line 816, in _execute_child
WindowsError: [Error 5] Access is denied
WindowsError: [Error 5] Access is denied
In Windows I used to see this error myself after installing Google App Engine SDK for PHP. This error occured when gae could not find the PHP executable.
The thing was I was specifying the absolute path to the folder that contained php-cgi.exe, leaving out the name of the executable php-cgi.exe! I solved this problem by adding the name of tyhe executable as well. So you might want to take a look again at your absolute path and make corrections.
from the docs:
Start the web server with the following command, giving it the path to
your project directory:
google_appengine/dev_appserver.py --php_executable_path=absolute-path-to-php-cgi.exe myproject/
Hope it helps,