小编Jam*_*s N的帖子

使用pip在python中安装模块失败

我在使用pip安装python模块时遇到问题.以下是命令窗口的输出:

请注意,我在尝试安装GDAL模块之前立即安装了pip.

我在运行python 2.7的w7 64位机器上

    Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\jnunn\Desktop>python get-pip.py
Downloading/unpacking pip
Downloading pip-1.2.1.tar.gz (102Kb): 102Kb downloaded
Running setup.py egg_info for package pip

warning: no files found matching '*.html' under directory 'docs'
warning: no previously-included files matching '*.txt' found under directory
'docs\_build'
no previously-included directories found matching 'docs\_build\_sources'
Installing collected packages: pip
Running setup.py install for pip

warning: no files found matching '*.html' under directory 'docs'
warning: no previously-included files matching …
Run Code Online (Sandbox Code Playgroud)

python windows install pip gdal

12
推荐指数
1
解决办法
5万
查看次数

如何确定目录是否是有效的 PostgreSQL 集群

我有一些代码在给定路径上调用 pg_ctl 命令并检查输出以确定它是否是有效的 PostgreSQL 集群: pg_ctl status -D <data_directory>

但是,在对已知的非集群目录进行单元测试时,它并不能可靠地返回pg_ctl: directory <data_directory> is not a database cluster directory我的构建服务器上的预期结果;相反,它返回pg_ctl: no server running.

有没有更简单的方法来确定目录是否是有效的集群?

postgresql

11
推荐指数
1
解决办法
1万
查看次数

清除字符串变量内容的不同方法之间有什么区别吗?

给定一个字符串变量设置为某个值:

string s = "Hello";

以下方法之间是否有任何区别(性能,陷阱)以清除内容?:

s = ""

s = std::string()

s.clear()

我从这个答案中得到了关于清除变量的问题的示例代码/sf/answers/813231681/

c++

9
推荐指数
1
解决办法
104
查看次数

Python win32com.client.Dispatch循环遍历Word文档并导出为PDF; 下一个循环发生时失败

基于这里的脚本:.doc到pdf使用python我有一个半工作脚本将.docx文件从C:\ Export_to_pdf导出到pdf到一个新文件夹.

问题是它通过前几个文件然后失败:

(-2147352567, 'Exception occurred.', (0, u'Microsoft Word', u'Command failed', u'wdmain11.chm', 36966, -2146824090), None)
Run Code Online (Sandbox Code Playgroud)

这显然是一个无益的一般错误信息.如果我使用pdb慢慢调试它,我可以遍历所有文件并成功导出.如果我也关注Windows任务管理器中的进程,我可以看到WINWORD启动然后在应该结束时结束,但是在较大的文件上,内存使用需要更长时间才能稳定.这让我觉得,当在client.Dispatch对象上调用下一个方法之前,WINWORD没有时间初始化或退出时,脚本会跳闸.

是否有一种方法可以使用win32com或comtypes来识别并等待进程启动或完成?

我的剧本:

import os
from win32com import client

folder = "C:\\Export_to_pdf"
file_type = 'docx'
out_folder = folder + "\\PDF"

os.chdir(folder)

if not os.path.exists(out_folder):
    print 'Creating output folder...'
    os.makedirs(out_folder)
    print out_folder, 'created.'
else:
    print out_folder, 'already exists.\n'

for files in os.listdir("."):
    if files.endswith(".docx"):
        print files

print '\n\n'

try:
    for files in os.listdir("."):
        if files.endswith(".docx"):
            out_name = files.replace(file_type, r"pdf")
            in_file = os.path.abspath(folder + "\\" …
Run Code Online (Sandbox Code Playgroud)

python pdf docx comtypes win32com

3
推荐指数
1
解决办法
8972
查看次数

标签 统计

python ×2

c++ ×1

comtypes ×1

docx ×1

gdal ×1

install ×1

pdf ×1

pip ×1

postgresql ×1

win32com ×1

windows ×1