Posts

Showing posts from 2015

SUDDEN "Permission denied (publickey,gssapi-keyex,gssapi-with-mic)." !!

On Google Compute Engine, my server suddenly ceased to respond "gcloud compute ssh" command 3 days ago. It only shows Permission denied (publickey,gssapi-keyex,gssapi-with-mic). After making new account, I looked into the /var/log/secure, but it only said Connection closed by xxx.xxx.xxx.xxx Changing LogLevel of /etc/ssh/sshd_config to VERBOSE doesn't make big difference. It only showed Failed publickey for [ login name ] from xxx.xxx.xxx.xxx port xxxxx ssh2 Connection closed by xxx.xxx.xxx.xxx Googling about ssh login problems, many blogs tell to doubt permissions of ssh files and directories, such as ~/.ssh and ~/.ssh/authorized_keys, but they seemed to have proper permissions. Now, I just found the home directory(~/) also has to have permission 700. It's embarrassing I do not remember how the permission changed in the first place, but I hope this will help somebody from spending three very useless days. Conclusion, when you suddenly cannot connect to

Dump UTF-8 object to JSON file on Python.(JUST REMINDER for myself)

with open('xxx.json', 'w', encoding='utf-8') as f: f.write(json.dumps(obj, indent=2, ensure_ascii=False))

In case having problem with Vagrant Sync folders...

After being stuck with vagrant that sync-folders are not synced on vagrant up, I seem to find a way to fix it. Here is the way I tried. * host-os: OSX Yosemite & guest-os: CentOS6 1. Install vagrant guest plugin. vagrant plugin install vagrant-vbguest 2. update kernel on vagrant's guest. sudo yum install kernel-devel sudo yum update kernel* 3. exit guest and reload vagrant. vagrant reload 

Writing tornado.testing.test as simple python script (and pass command line options to the testee).

I wanted to execute tornado.testing unit test with command line options(tornado.options). Something like python3 -m tornado.test.runtests test.py --port=8080 However I found this is impossible, because runtests tries to process options by itself. Then I tried to do this   python3 test.py --port=8080 by putting following code at the end of the test script(test.py in this case). if __name__ == "__main__":   tornado.testing.main()  * tornado.options.parse_command_line() is called at the top of the testee's program. This didn't work because of "AttributeError: 'module' object has no attribute 'all'" error. So, I avoided this problem by adding "all()" function to the test.py like this, and it finally works. def all():     import unittest     return unittest.defaultTestLoader.loadTestsFromNames([__name__])

Subclassing and Signal connect on a same widget crashes PySide application on exit.

In pyside, I wanted to do something like these, class MyTextLine(QLineEdit): def focusInEvent(self, e): #do something QLineEdit.focusInEvent(self, e) .... widget = MyTextLine(QLineEdit) widget.editingFinished.connect(some_callback) However, this app tends to crash on exit. Core dump saids it is something about destructor of a signal manager. Details are rather vague, but I managed to avoid crash deleting signal-connect. class MyTextLine(QLineEdit): def focusInEvent(self, e): #do something QLineEdit.focusInEvent(self, e) def setCallback(self, cb): self.cb = cb def focusOutEvent(self, e): if hasattr(self, 'cb'): self.cb() .... widget = MyTextLine(QLineEdit) widget.setCallback(some_callback) If anyone knows why this happens, please teach me! One more thing, if you use QTreeWidget having widgets on it, it seems better to do clear() it before closing your application. Update 2015/01/25: It seems like widget.se