$json = json_decode($json, true);
$i = 0;
$candidate1 = array();
// Within the array.. find the ad that matches the POST variable.
foreach ($json['ads'] as $ad) {
if ($ad['id'] == $ad_id) {
$candidate1["id"] = $ad["id"];
$candidate1["hirername"] = $ad["hirername"];
// Within that Ad... find the candidate that matches the POST variable.
foreach ($ad['candidates'] as $candidate) {
if ($candidate['name'] == $name) {
$candidate1[$i] = $candidate;
$candidate['status'] == 'active' ? $candidate1[$i]['status'] = 'inactive' : $candidate1[$i]['status'] = 'active';
} else {
$candidate1[$i] = $candidate;
}
$i++;
}
}
}
$json = json_encode($candidate1);
$ret = file_put_contents('test.json', $json, LOCK_EX);
我见过: http://error.news/question/6131746/why-does-pip-install-winshell-not-work-on-python-v342/
但我分别安装了pywin32 64位并通过exe:
完成https://drive.google.com/file/d/0B2FZnKhR7OOJZ1hYZER2WUwyUzA/view?usp=sharing
那么如何:Why does pip install winshell not work on Python v3.4.2?
呃,不。我安装了它。
然后我去看了:What's win32con module in python? Where can I find it?
我需要知道:我需要做些什么才能让winshell工作。我已经手动安装了pywin32(64位),我运行了pywin32(64位)的exe并成功完成了它,然后我继续进行CMD并做了:
Traceback (most recent call last):
File "C:/Users/owner/Desktop/2/test2.py", line 1, in <module>
import os, winshell
File "C:\py35\lib\site-packages\winshell.py", line 30, in <module>
import win32con
ImportError: No module named 'win32con'
安装成功完成。但是,导入winshell仍然无效!
答案 0 :(得分:2)
它最后工作了 我做了什么: 使用提升的权限和命令运行CMD:
cd pathto\pythondirectory\scripts
pywin32_postinstall.py -install
事实证明,如果您没有完整的管理员,这将无法运行并且DLL不会正确复制。
另一个非常值得注意的页面:https://blogs.msdn.microsoft.com/pythonengineering/2016/04/11/unable-to-find-vcvarsall-bat/
答案 1 :(得分:2)
winshell包的依赖项列表中存在错误。 pypiwin32包是必需的。已经向winshell包的维护者报告了这个bug,但遗憾的是维护者似乎已经停止支持它了。我使用了来自http://www.lfd.uci.edu/~gohlke/pythonlibs/#winshell的winshell包,因为它比PyPI(版本0.6)更新(版本0.6.4)。有关详细信息和有用的链接,请参阅What's win32con module in python? Where can I find it?。
pip install pypiwin32
[Download Gohlke's package to a local folder, C:\downloads\new in this example.]
pip install C:\downloads\new\winshell-0.6.4-py2.py3-none-any.whl