Python 3.4 and Windows Shared File Paths - windows

I am trying to open a file in a shared network location
open('\\int\GroupData\ITProSup\Operations Support\REMGROUP.txt','+r')
Now this turns into
nemonics>python main.py
eback (most recent call last):
le "main.py", line 41, in <module>
sys.exit(main())
le "main.py", line 36, in main
insert_file_into_db(con_S104838,open('\\int\GroupData\ITProSup\Operations Su
t\REMGROUP.txt','+r'))
NotFoundError: [Errno 2] No such file or directory: '\\int\\GroupData\\ITPro
\Operations Support\\REMGROUP.txt'
I have tried this thread Using Python, how can I access a shared folder on windows network? but it does note seem to work for me. I am running python 3.4.1 and its windows 2012 server.
I have also tried using os.path https://docs.python.org/3.4/library/os.path.html#os.path.normpath with not much luck
C:\mnemonics>python main.py
Traceback (most recent call last):
File "main.py", line 41, in <module>
sys.exit(main())
File "main.py", line 36, in main
insert_file_into_db(con_S104838, open(os.path.normpath('\\int\GroupData\ITPr
oSup\Operations Support\REMGROUP.txt')))
FileNotFoundError: [Errno 2] No such file or directory: '\\int\\GroupData\\ITPro
Sup\\Operations Support\\REMGROUP.txt'
C:\mnemonics>python main.py
Traceback (most recent call last):
File "main.py", line 42, in <module>
sys.exit(main())
File "main.py", line 37, in main
open(os.path.normcase('\\int\GroupData\ITProSup\Operations Support\REMGROUP.
txt'),'+r'))
FileNotFoundError: [Errno 2] No such file or directory: '\\int\\groupdata\\itpro
sup\\operations support\\remgroup.txt'
Any help would be greatly appreciated

Note that \ should be escaped to \\, so \\ should be \\\\
Please try
'\\\\int\\GroupData\\ITProSup\\Operations Support\\REMGROUP.txt'
or
'//int/GroupData/ITProSup/Operations Support/REMGROUP.txt'

Related

Volttron on MacOS issue with vcfg

Running into the issue below while trying to run vcfg command in Volttron on my Mac use iTerm. Any help would be much appreciated.
'''
(volttron)cg#Carolyns-MacBook-Pro volttron % vcfg
Your VOLTTRON_HOME currently set to: /Users/cg/.volttron
Is this the volttron you are attempting to setup? [Y]:
Message bus set to zmq
What is the vip address? [tcp://127.0.0.1]:
What is the port for the vip address? [22916]:
Is this instance web enabled? [N]: Y
Traceback (most recent call last):
File "/Users/cg/volttron/env/bin/vcfg", line 11, in <module>
load_entry_point('volttron', 'console_scripts', 'vcfg')()
File "/Users/cg/volttron/volttron/platform/config.py", line 593, in _main
main()
File "/Users/cg/volttron/volttron/platform/instance_setup.py", line 862, in main
wizard()
File "/Users/cg/volttron/volttron/platform/instance_setup.py", line 748, in wizard
do_web_enabled_zmq(volttron_home)
File "/Users/cg/volttron/volttron/platform/instance_setup.py", line 433, in do_web_enabled_zmq
'https://' + get_hostname())
File "/Users/cg/volttron/volttron/utils/__init__.py", line 27, in get_hostname
with open('/etc/hostname') as fp:
IOError: [Errno 2] No such file or directory: '/etc/hostname'
'''
/etc/hostname does not exist on Mac. The documentation for Volttron indicates that it only supports Linux operating systems.. It seems like you'll have to use a Linux host (or use virtualization).

`ansible --version` command throws an ERROR

Good Day guys
I have installed ansible on my mac, it was successfully installed but then when I run the command ansible --version it throws me a n error:
Unhandled error:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/ansible/config/manager.py", line 559, in update_config_data
value, origin = self.get_config_value_and_origin(config, configfile)
File "/Library/Python/2.7/site-packages/ansible/config/manager.py", line 503, in get_config_value_and_origin
value = ensure_type(value, defs[config].get('type'), origin=origin)
File "/Library/Python/2.7/site-packages/ansible/config/manager.py", line 124, in ensure_type
value = tempfile.mkdtemp(prefix=prefix, dir=value)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tempfile.py", line 339, in mkdtemp
_os.mkdir(file, 0700)
OSError: [Errno 13] Permission denied: '/Users/patrick/.ansible/tmp/ansible-local-37505vvsQNX'
Traceback (most recent call last):
File "/usr/local/bin/ansible", line 62, in <module>
import ansible.constants as C
File "/Library/Python/2.7/site-packages/ansible/constants.py", line 174, in <module>
config = ConfigManager()
File "/Library/Python/2.7/site-packages/ansible/config/manager.py", line 291, in __init__
self.update_config_data()
File "/Library/Python/2.7/site-packages/ansible/config/manager.py", line 571, in update_config_data
raise AnsibleError("Invalid settings supplied for %s: %s\n" % (config, to_native(e)), orig_exc=e)
ansible.errors.AnsibleError: Invalid settings supplied for DEFAULT_LOCAL_TMP: [Errno 13] Permission denied: '/Users/patrick/.ansible/tmp/ansible-local-37505vvsQNX'
Appreciate your help guys.
Check if this is similar to iiab/iiab/issue 1212:
After some more digging, I found the real source of this problem was hardcoded paths in ansible.cfg
Or the more recent ansible/galaxy-dev issue 107, which leads to PR 110:
The default ansible temp dir ~/.ansible/tmp is accessed by ansible-doc via the galaxy-importer.
This works OK in the galaxy-dev local env, but on the CI environment it attempts to create dir /.ansible/tmp and fails.
This PR changes the default ansible temp dir to /tmp/ansible which is outside the user home (and in the local env, /tmp has greater permissions)
Try and change DEFAULT_LOCAL_TMP to /tmp.
~/.ansible/tmp is probably root, so not accessible. chown it to user
I have disabled 'gathering' in ansible.cfg to fix the issue.
# gathering = False
Below error occurring before commenting this.
~ % ansible
Unhandled error:
Traceback (most recent call last):
File "/opt/homebrew/Cellar/ansible/6.6.0/libexec/lib/python3.10/site-packages/ansible/config/manager.py", line 627, in update_config_data
value, origin = self.get_config_value_and_origin(config, configfile)
File "/opt/homebrew/Cellar/ansible/6.6.0/libexec/lib/python3.10/site-packages/ansible/config/manager.py", line 586, in get_config_value_and_origin
raise AnsibleOptionsError('Invalid value "%s" for configuration option "%s", valid values are: %s' %
ansible.errors.AnsibleOptionsError: Invalid value "False" for configuration option "setting: DEFAULT_GATHERING ", valid values are: implicit, explicit, smart

Kivy installation and UnicodeDecodeError

I'm trying to instal Kivy on my Windows 10 Polish language.
Python 3.8
PIP 19.3.1
When i get to step:
python -m virtualenv kivy_venv
im getting error:
C:\Users\Paweł>python -m virtualenv kivy_venv
Using base prefix 'C:\\Python\\Python38-32'
New python executable in C:\Users\Paweł\kivy_venv\Scripts\python.exe
Installing setuptools, pip, wheel...
done.
Traceback (most recent call last):
File "C:\Python\Python38-32\lib\site-packages\virtualenv.py", line 939, in call_subprocess
line = line.decode(encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb3 in position 42: invalid start byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python\Python38-32\lib\runpy.py", line 192, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Python\Python38-32\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Python\Python38-32\lib\site-packages\virtualenv.py", line 2634, in <module>
main()
File "C:\Python\Python38-32\lib\site-packages\virtualenv.py", line 860, in main
create_environment(
File "C:\Python\Python38-32\lib\site-packages\virtualenv.py", line 1179, in create_environment
install_wheel(to_install, py_executable, search_dirs, download=download)
File "C:\Python\Python38-32\lib\site-packages\virtualenv.py", line 1023, in install_wheel
_install_wheel_with_search_dir(download, project_names, py_executable, search_dirs)
File "C:\Python\Python38-32\lib\site-packages\virtualenv.py", line 1116, in _install_wheel_with_search_dir
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=script)
File "C:\Python\Python38-32\lib\site-packages\virtualenv.py", line 941, in call_subprocess
line = line.decode(fs_encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb3 in position 42: invalid start byte
I couldn't find solution to this version of python or pip that's why i ask for help.
If you have any ideas please let me know.
Thanks
Find solution
Control panel regional settings Beta: Use Unicode UTF-8 for worldwide language support must be tick.
Use Unicode UTF-8

Odoo10 Working setup now failing with ImportError: No module named conf

Working setup failing with ImportError: No module named conf
I stopped test setup on localhost with ^c to check logs
on restart I am getting error
C:\Odoo 10.0\server>odoo-bin -d todo -i todo_app --test-enable --dev=all
Traceback (most recent call last):
File "odoo-bin", line 2, in <module>
File "pkg_resources\__init__.pyc", line 2203, in declare_namespace
File "pkg_resources\__init__.pyc", line 2219, in declare_namespace
File "pkg_resources\__init__.pyc", line 2186, in _handle_ns
File "pkgutil.pyc", line 246, in load_module
argument should be the name of a package, in standard module format
File "C:\Odoo 10.0\server\odoo\__init__.py", line 61, in <module>
import conf
ImportError: No module named conf
TEST - Create folder conf with init.py from github
RESULT
C:\Odoo 10.0\server>odoo-bin -d todo -i todo_app --test-enable --dev=all
Traceback (most recent call last):
File "odoo-bin", line 2, in <module>
File "pkg_resources\__init__.pyc", line 2203, in declare_namespace
File "pkg_resources\__init__.pyc", line 2219, in declare_namespace
File "pkg_resources\__init__.pyc", line 2186, in _handle_ns
File "pkgutil.pyc", line 246, in load_module
argument should be the name of a package, in standard module format
File "C:\Odoo 10.0\server\odoo\__init__.py", line 61, in <module>
import conf
File "C:\Odoo 10.0\server\odoo\conf\__init__.py", line 15, in <module>
import deprecation
ImportError: No module named deprecation
CONCLUSION - Something happened to module conf - but I do not know what as I have made no such changes - John
I think you are using python 3.x .
this problem happened to me on linux but after using python 2.7.x it started as normal.

Emscripten "Permission Denied" even when I sudo enmake

I'm playing around with emscripten and I keep getting this confusing message
|[413077]-$>../emmake Makefile
Error: Exception thrown when invoking Popen in make with args: "Makefile"!
Traceback (most recent call last):
File "../emmake", line 24, in <module>
shared.Building.make(sys.argv[1:])
File "/Users/jkirchartz/Dropbox/emscripten/tools/shared.py", line 670, in make
Popen(args, stdout=stdout, stderr=stderr, env=env).communicate()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 13] Permission denied
but even if I use sudo I get the same error:
|[254829]-$>sudo !!
sudo ../emmake Makefile
Password:
Error: Exception thrown when invoking Popen in make with args: "Makefile"!
Traceback (most recent call last):
File "../emmake", line 24, in <module>
shared.Building.make(sys.argv[1:])
File "/Users/jkirchartz/Dropbox/emscripten/tools/shared.py", line 670, in make
Popen(args, stdout=stdout, stderr=stderr, env=env).communicate()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 13] Permission denied
I'm on the sudoer's list, I have root access... but no matter what I do I get permission denied. Any ideas?
emmake expects the make executable as parameter, not Makefile. Just try ../emmake make.
All Building.make() does is call make. Check if you can run make yourself manually on the command line.

Resources