python error while executing post-commit script from console - python

#sh post-commit
I am getting bellow error, How to fix this.
sh post-commit
Traceback (most recent call last):
File "/SVNData/testrepo/hooks/mailer.py", line 1353, in <module>
sys.argv[3:3+expected_args])
File "/usr/lib/python2.7/dist-packages/svn/core.py", line 281, in run_app
return func(application_pool, *args, **kw)
File "/SVNData/testrepo/hooks/mailer.py", line 81, in main
revision = int(cmd_args[0])
ValueError: invalid literal for int() with base 10: ''
Thanks.

Try this:
revision = int(''.join(cmd_args[0].split()))

Related

How to solve "KeyError: 'cpu'" error when trying to generate configFileName.xml with Gem5toMcpat?

Hello I am trying to generate configFileName.xml by using the following command in Gem5toMcpat parser which is installed on ubuntu 20
python Program.py stats.txt config.json ARM_A9_2GHz.xml
but it showed me this error
Traceback (most recent call last):
File "Program.py", line 964, in <module>
main()
File "Program.py", line 38, in main
countCores(sys.argv[2])
File "Program.py", line 70, in countCores
noCores = len(configfile["system"]["cpu"])
KeyError: 'cpu'

Getting OSError when running script

I am trying to set up the ChirpSDK, but every time I configure and run the code, I get this error:
Traceback (most recent call last):
File "test.py", line 3, in <module>
chirp = ChirpSDK()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chirpsdk/chirpsdk.py", line 395, in __init__
self.read_chirprc(block)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chirpsdk/chirpsdk.py", line 501, in read_chirprc
raise IOError('Could not find a ~/.chirprc file')
OSError: Could not find a ~/.chirprc file
Exception ignored in: <function ChirpSDK.__del__ at 0x10fa31af0>
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chirpsdk/chirpsdk.py", line 422, in __del__
self.close()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chirpsdk/chirpsdk.py", line 470, in close
if self._sdk:
AttributeError: 'ChirpSDK' object has no attribute '_sdk'
I realize that the error is saying that my .chirprc file is not being recognized, but I have no idea how to remedy this. I created a .chirprc file in my /Users/username/ path, and named it c.chirprc (as the Chirp getting started article suggests), but I am still getting this error. Is there another part that I am missing? Am I reading the instructions wrong?
Thanks
The Chirp configuration file should be placed at /Users/<username>/.chirprc on macOS.
If you run ls -l ~/.chirprc in the terminal, do you get any results? If it displays no such file or directory then you have not created the file correctly.

Python code not working from cron job but works from command line via virtualenv

I am receiving different errors which I cannot determine the issue. It seems as though it has to do with the configparser.py NoSectionError(section). This code runs fine from the command line in the virtualenv.
Traceback (most recent call last):
File "/usr/lib/python3.5/configparser.py", line 1135, in _unify_values
sectiondict = self._sections[section]
KeyError: 'token'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/lvensel/projects/worklion01/worklion01/wl_cron.py", line 15, in <module>
wl_post_projects.post()
File "/home/lvensel/projects/worklion01/worklion01/wl_post_projects.py", line 15, in post
import wl_get_background_jobs
File "/home/lvensel/projects/worklion01/worklion01/wl_get_background_jobs.py", line 12, in <module>
oauth, token = wl_secure_token.fetch_token()
File "/home/lvensel/projects/worklion01/worklion01/wl_secure_token.py", line 17, in fetch_token
values = wl_get_ini.get_values()
File "/home/lvensel/projects/worklion01/worklion01/wl_get_ini.py", line 13, in get_values
'token_url': config.get('token', 'token_url'),
File "/usr/lib/python3.5/configparser.py", line 778, in get
d = self._unify_values(section, vars)
File "/usr/lib/python3.5/configparser.py", line 1138, in _unify_values
raise NoSectionError(section)
configparser.NoSectionError: No section: 'token'
Let me guess on what potentially happens:
Cron jobs are run by root
virtualenv is run by your user with a custom python environment.
root does not know about your virtualenv, then cannot match your user's python environment, thus your script fails. Probably with some cannot import or alike errors.
Have a look at replies here.

ansible unexpected exception no escaped character

I am fairly new to Ansible and to configuration management tools in general. I've been playing around with it for the last two days and for the life of me I can't get past typing out ansible testserver. It comes back with an error message that says Unexpected Exception: No escaped character. The full error message is:
mac-dgarcia:playbooks dgarcia$ ansible testserver -i hosts -m ping -vvv
Using /Users/dgarcia/Documents/Playbooks/ansible.cfg as config file
Unexpected Exception: No escaped character
the full traceback was:
Traceback (most recent call last):
File "/Users/dgarcia/Documents/Playbooks/ansible/bin/ansible", line 79, in <module>
sys.exit(cli.run())
File "/Users/dgarcia/Documents/Playbooks/ansible/lib/ansible/cli/adhoc.py", line 106, in run
inventory = Inventory(loader=loader, variable_manager=variable_manager, host_list=self.options.inventory)
File "/Users/dgarcia/Documents/Playbooks/ansible/lib/ansible/inventory/__init__.py", line 135, in __init__
self.parser = InventoryParser(filename=host_list)
File "/Users/dgarcia/Documents/Playbooks/ansible/lib/ansible/inventory/ini.py", line 45, in __init__
self._parse()
File "/Users/dgarcia/Documents/Playbooks/ansible/lib/ansible/inventory/ini.py", line 49, in _parse
self._parse_base_groups()
File "/Users/dgarcia/Documents/Playbooks/ansible/lib/ansible/inventory/ini.py", line 107, in _parse_base_groups
tokens = shlex.split(line)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shlex.py", line 279, in split
return list(lex)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shlex.py", line 269, in next
token = self.get_token()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shlex.py", line 96, in get_token
raw = self.read_token()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shlex.py", line 191, in read_token
raise ValueError, "No escaped character"
ValueError: No escaped character
Have searched everywhere I can on Google and came back with nothing. Any ideas?
I had the same issue and changing my host file to have only one line fixed the problem.
My host file looks like the following:
testserver ansible_ssh_host=128.0.0.1 ansible_ssh_port=2222 \
ansible_ssh_user=vagrant \
ansible_ssh_private_key_file=/home/bibryam/Desktop/.vagrant/machines/fabric/virtualbox/private_key

gitosis-init error | Traceback (most recent call last)

Hy Guys i got some error while setting up gitosis, i think its some kind of not installed python dependencies
here is my output
git#ubuntu-server ~ % sudo -H -u git gitosis-init < /home/git/cs8898_windows7_21.07.2014.pub
Traceback (most recent call last):
File "/usr/local/bin/gitosis-init", line 9, in <module>
load_entry_point('gitosis==0.2', 'console_scripts', 'gitosis-init')()
File "/usr/local/lib/python2.7/dist-packages/gitosis-0.2-py2.7.egg/gitosis/app.py", line 24, in run
return app.main()
File "/usr/local/lib/python2.7/dist-packages/gitosis-0.2-py2.7.egg/gitosis/app.py", line 38, in main
self.handle_args(parser, cfg, options, args)
File "/usr/local/lib/python2.7/dist-packages/gitosis-0.2-py2.7.egg/gitosis/init.py", line 121, in handle_args
user = ssh_extract_user(pubkey)
File "/usr/local/lib/python2.7/dist-packages/gitosis-0.2-py2.7.egg/gitosis/init.py", line 39, in ssh_extract_user
raise InsecureSSHKeyUsername(repr(user))
gitosis.init.InsecureSSHKeyUsername: Username contains not allowed characters: '----'
Would be nice to get some hints, i will try it my selfe too
This error comes from gitosis/init.py#L34-L39:
def ssh_extract_user(pubkey):
_, user = pubkey.rsplit(None, 1)
if ssh.isSafeUsername(user):
return user
else:
raise InsecureSSHKeyUsername(repr(user))
That means the content of your pubilc key file isn't abcd...(long_key)...xxxxx= yourName, but includes at the end ----.
Sanitizes its content or regenerate your keys.

Categories

Resources