脚本

pythonw.exe or python.exe?

匿名 (未验证) 提交于 2019-12-03 02:13:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Long story short: pythonw.exe does nothing, python.exe accepts nothing (which one should I use?) test.py: print "a" CMD window: C:\path>pythonw.exe test.py C:\path> C:\path>python.exe test.py File "C:\path\test.py", line 7 print "a" ^ SyntaxError: invalid syntax C:\path> Please tell me what I'm doing terrible wrong. 回答1: If you don't want a terminal window to pop up when you run your program use pythonw.exe ; Otherwise, use python.exe Regarding the syntax error: print is now a function in 3.x So use instead: print("a") 回答2: To summarize and

How to silence “sys.excepthook is missing” error?

匿名 (未验证) 提交于 2019-12-03 02:13:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: NB: I have not attempted to reproduce the problem described below under Windows, or with versions of Python other than 2.7.3. The most reliable way to elicit the problem in question is to pipe the output of the following test script through : (under bash ): try: for n in range(20): print n except: pass I.e.: % python testscript.py | : close failed in file object destructor: sys.excepthook is missing lost sys.stderr My question is: How can I modify the test script above to avoid the error message when the script is run as shown (under Unix/

Markdown2

自古美人都是妖i 提交于 2019-12-03 02:12:46
文章目录1、Markdown 介绍2、Markdown 编辑器3、MarkdownPad 2 的安装、配置3.1、下载3.2、安装3.3、破解4、异常4.1、在win10下html渲染错误 This view has crashed5、修改markdown处理器和渲染模式(必看)6、 优化配置6.1、 去缓存6.2、 代码高亮6.3、 文章目录自动生成(1)—— 推荐6.4、 文章目录自动生成(2)6.5、自定义样式(必看)6.5、滚动条居中 1、Markdown 介绍 Markdown 是一种轻量级标记语言,它允许人们使用易读易写的纯文本格式编写文档,然后转换成格式丰富的HTML页面。 —— 维基百科 Markdown提供了简洁、高效的文档标记语法,被广泛运用于各种开源项目的README文档、说明文档等。同时Markdown语法还兼容HTML语法,在某些场合也可以使用HTML语法来增强Markdown的展现格式。但是一般不建议这样使用,以免导致一些平台对Markdown的兼容问题。 掌握了 Markdown 语法进行写作,可以让多个开发者在编写文档时按照相同的格式写作。同时 Markdown 还能转换为各种其他格式,如 PDF、HTML,甚至通过 pandoc 工具还能转化为 word 格式。因此,掌握 Markdown 对于一个开发者来说是非常重要的一项技能。 2

How to debug a bash script?

匿名 (未验证) 提交于 2019-12-03 02:12:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Is there any way to debug a bash script? E.g something that prints a sort of execution log like "calling line 1", "calling line 2" etc. 回答1: sh -x script [arg1 ...] bash -x script [arg1 ...] These give you a trace of what is being executed. (See also 'Clarification' near the bottom of the answer.) Sometimes, you need to control the debugging within the script. In that case, as Cheeto reminded me, you can use: set -x This turns debugging on. You can then turn it off again with: set +x (You can find out the current tracing state by analyzing $

How to get current username in Windows Powershell?

匿名 (未验证) 提交于 2019-12-03 02:12:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: How to get the current username in Windows Powershell? 回答1: Found it: $env : UserName There is also: $env : UserDomain $env : ComputerName 回答2: [ System . Security . Principal . WindowsIdentity ]:: GetCurrent (). Name 回答3: $env:username is the easiest way 回答4: I thought it would be valuable to summarize and compare the given answers. If you want to access the environment variable : (easier/shorter/memorable option) [Environment]::UserName -- @ThomasBratt $env:username -- @Eoin whoami -- @galaktor If you want to access the windows

Error: TypeError: $(…).dialog is not a function

匿名 (未验证) 提交于 2019-12-03 02:11:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am having an issue getting a dialog to work as basic functionality. Here is my jQuery source imports: <script type="text/javascript" src="scripts/jquery-1.9.1.js"></script> <script type="text/javascript" src="scripts/jquery-ui-1.11.1.js"></script> <script type="text/javascript" src="scripts/json.debug.js"></script> Html: <button id="opener">open the dialog</button> <div id="dialog1" title="Dialog Title" hidden="hidden">I'm a dialog</div> <script type="text/javascript"> $("#opener").click(function() { $("#dialog1").dialog('open'); }); <

Automatically apply “git update-index --chmod=+x” to executable files

匿名 (未验证) 提交于 2019-12-03 02:11:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I frequently add bash scripts to my git repository, and the scripts have executable permissions in the linux filesystem prior to the git add . But after pushing the added files to a remote repository and pulling in another location, the files show up with non-executable permissions. There seem to be two ways to correct the problem: 1. chmod u + x $script git commit - am "fixing the script permissions... again..." or 2. git update - index -- chmod =+ x $script Instead of fixing up the permissions every time, is there a way to have

How to run a shell script on a Unix console or Mac terminal?

匿名 (未验证) 提交于 2019-12-03 02:11:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I know it, forget it and relearn it again. Time to write it down. 回答1: To run a non-executable sh script, use: sh myscript To run a non-executable bash script, use: bash myscript To start an executable (which is any file with executable permission); you just specify it by its path: /foo/bar /bin/bar ./bar To make a script executable, give it the necessary permission: chmod +x bar ./bar When a file is executable, the kernel is responsible for figuring out how to execte it. For non-binaries, this is done by looking at the first line of the

Does content_scripts matches “chrome-extension://*/*” work?

匿名 (未验证) 提交于 2019-12-03 02:11:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to run a content script on an iframe with a chrome-extension:// URL. I added a line to my manifest.json that I copied out of the documentation http://code.google.com/chrome/extensions/match_patterns.html chrome-extension://*/* But when I reload my extension I get an alert: Could not load extension from '/work/sirius/extension'. Invalid value for 'content_scripts[2].matches[0]': Invalid scheme. Any idea how to get this to worK? 回答1: I'm having the exact same problem, look at the API http://code.google.com/chrome/extensions/match

Secure FTP using Windows batch script

匿名 (未验证) 提交于 2019-12-03 02:11:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I currently have batch scripts on different servers that transfer a csv file to an FTP server at a different location. My script looks similar to this: echo user ftp_user> ftpcmd.dat echo password>> ftpcmd.dat echo put c:\directory\%1-export-%date%.csv>> ftpcmd.dat echo quit>> ftpcmd.dat ftp -n -s:ftpcmd.dat ftp.MyFTPSite.com del ftpcmd.dat If I wanted to require a secure transmission, is how would my script be updated? Thanks. 回答1: First, make sure you understand, if you need to use Secure FTP (=FTPS, as per your text) or SFTP (as per tag