Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1385463

Summary: python -c 'import psycopg2' blows up with an ugly error
Product: Red Hat Enterprise Linux 7 Reporter: Greg Scott <gscott>
Component: python-psycopg2Assignee: Pavel Raiskup <praiskup>
Status: CLOSED NOTABUG QA Contact: qe-baseos-daemons
Severity: high Docs Contact:
Priority: high    
Version: 7.2CC: databases-maint, dmoessne, gscott, pkajaba, pkubat, stirabos
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-10-17 16:53:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1385462    

Description Greg Scott 2016-10-17 06:06:23 UTC
Description of problem:

python -c 'import psycopg2' blows up with an ugly error.  I set this to high priority because it breaks the RHV 4.0 upgrade.

[root@rhevm2017 gregs]# python -c 'import psycopg2'
Current date and time Mon Oct 17 00:58:07 2016
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib64/python2.7/site-packages/psycopg2/__init__.py", line 50, in <module>
    from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: datetime initialization failed
[root@rhevm2017 gregs]#


Version-Release number of selected component (if applicable): 

RHEL 7.2


How reproducible:

at will

Steps to Reproduce:
1. Install RHEL 7.1.  yum update to 7.2.latest
2. Install RHV 4.0
3. run python -c 'import psycopg2'


Actual results:

It blows up with an ugly error.


Expected results:

It should run to completion.

Additional info:

The last several lines of strace python -c 'import psycopg2' look like:
.
.
.
stat("_heapq", 0x7ffd60f2a180)          = -1 ENOENT (No such file or directory)
open("_heapq.so", O_RDONLY)             = -1 ENOENT (No such file or directory)
open("_heapqmodule.so", O_RDONLY)       = -1 ENOENT (No such file or directory)
open("_heapq.py", O_RDONLY)             = -1 ENOENT (No such file or directory)
open("_heapq.pyc", O_RDONLY)            = -1 ENOENT (No such file or directory)
stat("/usr/lib64/python2.7/_heapq", 0x7ffd60f2a180) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/_heapq.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/_heapqmodule.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/_heapq.py", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/_heapq.pyc", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/usr/lib64/python2.7/plat-linux2/_heapq", 0x7ffd60f2a180) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/plat-linux2/_heapq.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/plat-linux2/_heapqmodule.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/plat-linux2/_heapq.py", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/plat-linux2/_heapq.pyc", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/usr/lib64/python2.7/lib-dynload/_heapq", 0x7ffd60f2a180) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/lib-dynload/_heapq.so", O_RDONLY) = 9
fstat(9, {st_mode=S_IFREG|0755, st_size=22856, ...}) = 0
open("/usr/lib64/python2.7/lib-dynload/_heapq.so", O_RDONLY|O_CLOEXEC) = 10
read(10, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\16\0\0\0\0\0\0"..., 832) = 832
fstat(10, {st_mode=S_IFREG|0755, st_size=22856, ...}) = 0
mmap(NULL, 2117040, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 10, 0) = 0x7f472695e000
mprotect(0x7f4726961000, 2093056, PROT_NONE) = 0
mmap(0x7f4726b60000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 10, 0x2000) = 0x7f4726b60000
close(10)                               = 0
mprotect(0x7f4726b60000, 4096, PROT_READ) = 0
close(9)                                = 0
close(7)                                = 0
close(6)                                = 0
close(5)                                = 0
stat("/usr/lib64/python2.7/logging/atexit", 0x7ffd60f2b1d0) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/logging/atexit.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/logging/atexitmodule.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/logging/atexit.py", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/logging/atexit.pyc", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("atexit", 0x7ffd60f2b1d0)          = -1 ENOENT (No such file or directory)
open("atexit.so", O_RDONLY)             = -1 ENOENT (No such file or directory)
open("atexitmodule.so", O_RDONLY)       = -1 ENOENT (No such file or directory)
open("atexit.py", O_RDONLY)             = -1 ENOENT (No such file or directory)
open("atexit.pyc", O_RDONLY)            = -1 ENOENT (No such file or directory)
stat("/usr/lib64/python2.7/atexit", 0x7ffd60f2b1d0) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/atexit.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/atexitmodule.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/atexit.py", O_RDONLY) = 5
fstat(5, {st_mode=S_IFREG|0644, st_size=1705, ...}) = 0
open("/usr/lib64/python2.7/atexit.pyc", O_RDONLY) = 6
fstat(6, {st_mode=S_IFREG|0644, st_size=2203, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f47341cf000
read(6, "\3\363\r\n\317B\304Wc\0\0\0\0\0\0\0\0\4\0\0\0@\0\0\0s\300\0\0\0d\0"..., 4096) = 2203
fstat(6, {st_mode=S_IFREG|0644, st_size=2203, ...}) = 0
read(6, "", 4096)                       = 0
close(6)                                = 0
munmap(0x7f47341cf000, 4096)            = 0
close(5)                                = 0
close(4)                                = 0
stat("/usr/lib64/python2.7/site-packages/systemd/syslog", 0x7ffd60f2b790) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/site-packages/systemd/syslog.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/site-packages/systemd/syslogmodule.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/site-packages/systemd/syslog.py", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/site-packages/systemd/syslog.pyc", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("syslog", 0x7ffd60f2b790)          = -1 ENOENT (No such file or directory)
open("syslog.so", O_RDONLY)             = -1 ENOENT (No such file or directory)
open("syslogmodule.so", O_RDONLY)       = -1 ENOENT (No such file or directory)
open("syslog.py", O_RDONLY)             = -1 ENOENT (No such file or directory)
open("syslog.pyc", O_RDONLY)            = -1 ENOENT (No such file or directory)
stat("/usr/lib64/python2.7/syslog", 0x7ffd60f2b790) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/syslog.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/syslogmodule.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/syslog.py", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/syslog.pyc", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/usr/lib64/python2.7/plat-linux2/syslog", 0x7ffd60f2b790) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/plat-linux2/syslog.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/plat-linux2/syslogmodule.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/plat-linux2/syslog.py", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/plat-linux2/syslog.pyc", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/usr/lib64/python2.7/lib-dynload/syslog", 0x7ffd60f2b790) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/lib-dynload/syslog.so", O_RDONLY) = 4
fstat(4, {st_mode=S_IFREG|0755, st_size=11600, ...}) = 0
open("/usr/lib64/python2.7/lib-dynload/syslog.so", O_RDONLY|O_CLOEXEC) = 5
read(5, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340\r\0\0\0\0\0\0"..., 832) = 832
fstat(5, {st_mode=S_IFREG|0755, st_size=11600, ...}) = 0
mmap(NULL, 2105848, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 5, 0) = 0x7f472675b000
mprotect(0x7f472675d000, 2093056, PROT_NONE) = 0
mmap(0x7f472695c000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 5, 0x1000) = 0x7f472695c000
close(5)                                = 0
mprotect(0x7f472695c000, 4096, PROT_READ) = 0
close(4)                                = 0
stat("/usr/lib64/python2.7/site-packages/systemd/_journal", 0x7ffd60f2b790) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/site-packages/systemd/_journal.so", O_RDONLY) = 4
fstat(4, {st_mode=S_IFREG|0755, st_size=11752, ...}) = 0
open("/usr/lib64/python2.7/site-packages/systemd/_journal.so", O_RDONLY|O_CLOEXEC) = 5
read(5, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832
fstat(5, {st_mode=S_IFREG|0755, st_size=11752, ...}) = 0
mmap(NULL, 12609, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 5, 0) = 0x7f47341cc000
mmap(0x7f47341ce000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 5, 0x1000) = 0x7f47341ce000
close(5)                                = 0
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 5
fstat(5, {st_mode=S_IFREG|0644, st_size=40495, ...}) = 0
mmap(NULL, 40495, PROT_READ, MAP_PRIVATE, 5, 0) = 0x7f4734001000
close(5)                                = 0
open("/lib64/libsystemd.so.0", O_RDONLY|O_CLOEXEC) = 5
read(5, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832
fstat(5, {st_mode=S_IFREG|0755, st_size=162560, ...}) = 0
mmap(NULL, 162596, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 5, 0) = 0x7f4733fd9000
mmap(0x7f4733fff000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 5, 0x25000) = 0x7f4733fff000
close(5)                                = 0
open("/lib64/libcap.so.2", O_RDONLY|O_CLOEXEC) = 5
read(5, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 \26\0\0\0\0\0\0"..., 832) = 832
fstat(5, {st_mode=S_IFREG|0755, st_size=20024, ...}) = 0
mmap(NULL, 2114112, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 5, 0) = 0x7f4726556000
mprotect(0x7f472655a000, 2093056, PROT_NONE) = 0
mmap(0x7f4726759000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 5, 0x3000) = 0x7f4726759000
close(5)                                = 0
open("/lib64/libgcrypt.so.11", O_RDONLY|O_CLOEXEC) = 5
read(5, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0u\0\0\0\0\0\0"..., 832) = 832
fstat(5, {st_mode=S_IFREG|0755, st_size=534488, ...}) = 0
mmap(NULL, 2621456, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 5, 0) = 0x7f47262d5000
mprotect(0x7f4726351000, 2097152, PROT_NONE) = 0
mmap(0x7f4726551000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 5, 0x7c000) = 0x7f4726551000
mmap(0x7f4726555000, 16, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f4726555000
close(5)                                = 0
open("/lib64/libgpg-error.so.0", O_RDONLY|O_CLOEXEC) = 5
read(5, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000\n\0\0\0\0\0\0"..., 832) = 832
fstat(5, {st_mode=S_IFREG|0755, st_size=19384, ...}) = 0
mmap(NULL, 2113656, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 5, 0) = 0x7f47260d0000
mprotect(0x7f47260d4000, 2093056, PROT_NONE) = 0
mmap(0x7f47262d3000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 5, 0x3000) = 0x7f47262d3000
close(5)                                = 0
open("/lib64/libdw.so.1", O_RDONLY|O_CLOEXEC) = 5
read(5, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200\227\0\0\0\0\0\0"..., 832) = 832
fstat(5, {st_mode=S_IFREG|0755, st_size=297464, ...}) = 0
mmap(NULL, 2386184, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 5, 0) = 0x7f4725e89000
mprotect(0x7f4725ece000, 2093056, PROT_NONE) = 0
mmap(0x7f47260cd000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 5, 0x44000) = 0x7f47260cd000
close(5)                                = 0
open("/lib64/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 5
read(5, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360*\0\0\0\0\0\0"..., 832) = 832
fstat(5, {st_mode=S_IFREG|0755, st_size=88720, ...}) = 0
mmap(NULL, 2184192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 5, 0) = 0x7f4725c73000
mprotect(0x7f4725c88000, 2093056, PROT_NONE) = 0
mmap(0x7f4725e87000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 5, 0x14000) = 0x7f4725e87000
close(5)                                = 0
open("/lib64/libattr.so.1", O_RDONLY|O_CLOEXEC) = 5
read(5, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\23\0\0\0\0\0\0"..., 832) = 832
fstat(5, {st_mode=S_IFREG|0755, st_size=19888, ...}) = 0
mmap(NULL, 2113904, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 5, 0) = 0x7f4725a6e000
mprotect(0x7f4725a72000, 2093056, PROT_NONE) = 0
mmap(0x7f4725c71000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 5, 0x3000) = 0x7f4725c71000
close(5)                                = 0
open("/usr/lib64/elfutils/tls/x86_64/libelf.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib64/elfutils/tls/x86_64", 0x7ffd60f2b610) = -1 ENOENT (No such file or directory)
open("/usr/lib64/elfutils/tls/libelf.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib64/elfutils/tls", 0x7ffd60f2b610) = -1 ENOENT (No such file or directory)
open("/usr/lib64/elfutils/x86_64/libelf.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib64/elfutils/x86_64", 0x7ffd60f2b610) = -1 ENOENT (No such file or directory)
open("/usr/lib64/elfutils/libelf.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib64/elfutils", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/lib64/libelf.so.1", O_RDONLY|O_CLOEXEC) = 5
read(5, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p+\0\0\0\0\0\0"..., 832) = 832
fstat(5, {st_mode=S_IFREG|0755, st_size=91496, ...}) = 0
mmap(NULL, 2183520, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 5, 0) = 0x7f4725858000
mprotect(0x7f472586d000, 2093056, PROT_NONE) = 0
mmap(0x7f4725a6c000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 5, 0x14000) = 0x7f4725a6c000
close(5)                                = 0
open("/usr/lib64/elfutils/libbz2.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/lib64/libbz2.so.1", O_RDONLY|O_CLOEXEC) = 5
read(5, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`\27\0\0\0\0\0\0"..., 832) = 832
fstat(5, {st_mode=S_IFREG|0755, st_size=68192, ...}) = 0
mmap(NULL, 2162024, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 5, 0) = 0x7f4725648000
mprotect(0x7f4725657000, 2093056, PROT_NONE) = 0
mmap(0x7f4725856000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 5, 0xe000) = 0x7f4725856000
close(5)                                = 0
mprotect(0x7f4725856000, 4096, PROT_READ) = 0
mprotect(0x7f4725a6c000, 4096, PROT_READ) = 0
mprotect(0x7f4725c71000, 4096, PROT_READ) = 0
mprotect(0x7f4725e87000, 4096, PROT_READ) = 0
stat("/etc/sysconfig/64bit_strstr_via_64bit_strstr_sse2_unaligned", 0x7ffd60f2c050) = -1 ENOENT (No such file or directory)
mprotect(0x7f47260cd000, 8192, PROT_READ) = 0
mprotect(0x7f47262d3000, 4096, PROT_READ) = 0
mprotect(0x7f4726551000, 4096, PROT_READ) = 0
mprotect(0x7f4726759000, 4096, PROT_READ) = 0
mprotect(0x7f4733fff000, 4096, PROT_READ) = 0
mprotect(0x7f47341ce000, 4096, PROT_READ) = 0
access("/etc/system-fips", F_OK)        = -1 ENOENT (No such file or directory)
munmap(0x7f4734001000, 40495)           = 0
close(4)                                = 0
stat("/usr/lib64/python2.7/site-packages/systemd/_reader", 0x7ffd60f2b790) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/site-packages/systemd/_reader.so", O_RDONLY) = 4
fstat(4, {st_mode=S_IFREG|0755, st_size=50272, ...}) = 0
open("/usr/lib64/python2.7/site-packages/systemd/_reader.so", O_RDONLY|O_CLOEXEC) = 5
read(5, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832
fstat(5, {st_mode=S_IFREG|0755, st_size=50272, ...}) = 0
mmap(NULL, 52584, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 5, 0) = 0x7f472563b000
mprotect(0x7f4725643000, 4096, PROT_NONE) = 0
mmap(0x7f4725644000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 5, 0x8000) = 0x7f4725644000
close(5)                                = 0
mprotect(0x7f4725644000, 4096, PROT_READ) = 0
close(4)                                = 0
close(3)                                = 0
write(2, "Traceback (most recent call last"..., 35Traceback (most recent call last):
) = 35
write(2, "  File \"<string>\", line 1, in <m"..., 39  File "<string>", line 1, in <module>
) = 39
open("<string>", O_RDONLY)              = -1 ENOENT (No such file or directory)
open("<string>", O_RDONLY)              = -1 ENOENT (No such file or directory)
open("/usr/lib64/python27.zip/<string>", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/<string>", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/plat-linux2/<string>", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/lib-tk/<string>", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/lib-old/<string>", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/lib-dynload/<string>", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/site-packages/<string>", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.7/site-packages/gtk-2.0/<string>", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.7/site-packages/<string>", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "  File \"/usr/lib64/python2.7/sit"..., 87  File "/usr/lib64/python2.7/site-packages/psycopg2/__init__.py", line 50, in <module>
) = 87
open("/usr/lib64/python2.7/site-packages/psycopg2/__init__.py", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=5838, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f47341cb000
read(3, "\"\"\"A Python driver for PostgreSQ"..., 4096) = 4096
write(2, "    ", 4    )                     = 4
write(2, "from psycopg2._psycopg import BI"..., 70from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
) = 70
close(3)                                = 0
munmap(0x7f47341cb000, 4096)            = 0
write(2, "ImportError", 11ImportError)             = 11
write(2, ": ", 2: )                       = 2
write(2, "datetime initialization failed", 30datetime initialization failed) = 30
write(2, "\n", 1
)                       = 1
rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x7f47339de100}, {0x7f4733cfc6a0, [], SA_RESTORER, 0x7f47339de100}, 8) = 0
close(8)                                = 0
exit_group(1)                           = ?
+++ exited with 1 +++
[root@rhevm2017 gregs]#

Comment 1 Pavel Raiskup 2016-10-17 06:22:03 UTC
Not reproducible.  Greg, as I asked you before, have you tried:
python -c 'import datetime' ?

Comment 3 Greg Scott 2016-10-17 14:01:11 UTC
Sorry Pavel, I missed that last night. This might be a huge clue.  I log onto my new RHV server as root, but I put the .bck file and logs in /home/gregs.

I don't get what's going on here. Why does it behave differently when I cd to root vs. when I'm sitting in /home/gregs while logged in as root?

[root@rhevm2017 gregs]# python -c 'import datetime'
Current date and time Mon Oct 17 08:58:39 2016
[root@rhevm2017 gregs]# python -c 'import psycopg2'
Current date and time Mon Oct 17 08:58:44 2016
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib64/python2.7/site-packages/psycopg2/__init__.py", line 50, in <module>
    from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: datetime initialization failed
[root@rhevm2017 gregs]# pwd
/home/gregs
[root@rhevm2017 gregs]# 
[root@rhevm2017 gregs]# 
[root@rhevm2017 gregs]# cd
[root@rhevm2017 ~]# pwd
/root
[root@rhevm2017 ~]# python -c 'import datetime'
[root@rhevm2017 ~]# python -c 'import psycopg2'
[root@rhevm2017 ~]#

Comment 4 Greg Scott 2016-10-17 14:23:33 UTC
And we figured out what's going on. I am a dork.

Short version - I stumbled onto a naming conflict tinkering with python and then forgot all about it.

[root@rhevm2017 ~]# cd /home/gregs
[root@rhevm2017 gregs]# ls -al
total 13556
drwx------. 2 gregs gregs     4096 Oct 17 08:54 .
drwxr-xr-x. 3 root  root        18 May 25  2015 ..
-rw-r--r--. 1 root  root  13761238 Oct 17 00:20 backup.bck
-rw-r--r--. 1 root  root      3512 Sep 13 14:00 backuplog.log
-rw-r--r--. 1 gregs gregs       18 Jan 11  2015 .bash_logout
-rw-r--r--. 1 gregs gregs      193 Jan 11  2015 .bash_profile
-rw-r--r--. 1 gregs gregs      231 Jan 11  2015 .bashrc
-rwxr-xr-x. 1 root  root      1020 Sep 13 13:58 createvm-binary.py
-rwxr-xr-x. 1 root  root       993 Sep 13 13:58 createvm-original.py
-rwxr-xr-x. 1 root  root       975 Sep 13 13:58 createvm.py
-rwxr-xr-x. 1 root  root        83 Sep 13 13:58 datetime.py
-rw-r--r--. 1 root  root       191 Sep 15 11:00 datetime.pyc
-rwxr-xr-x. 1 root  root      1069 Sep 13 13:58 fire-up-iostat.sh
-rw-r--r--. 1 root  root        77 Sep 13 13:58 import.py
-rwxr-xr-x. 1 root  root       408 Sep 13 13:58 listdc.py
-rwxr-xr-x. 1 root  root       130 Sep 13 13:58 printit.py
-rwxr-xr-x. 1 root  root       545 Sep 13 13:58 processes.sh
-rw-r--r--. 1 root  root      4242 Sep 15 09:30 restore20160915.log
-rw-r--r--. 1 root  root      1189 Oct 17 00:17 restore20161016b.log
-rw-r--r--. 1 root  root      1189 Oct 17 00:20 restore20161016c.log
-rw-r--r--. 1 root  root      1189 Oct 16 23:45 restore20161016.log
-rw-r--r--. 1 root  root      1189 Oct 17 08:54 restore2016-1017e.log
-rw-r--r--. 1 root  root      1189 Oct 17 00:42 restore20161017.log
-rw-r--r--. 1 root  root      1189 Sep 14 10:19 restoreconsole.log
-rwxr-xr-x. 1 root  root       280 Sep 13 13:58 seconds.sh
-rwxr-xr-x. 1 root  root       639 Sep 13 13:58 setWAD.py
-rwxr-xr-x. 1 root  root      3663 Sep 13 13:58 stresstest1.py
-rwxr-xr-x. 1 root  root      3986 Sep 13 13:58 stresstest.py
-rw-r--r--. 1 root  root       676 Sep 13 13:59 stresstest.rhevm
-rwxr-xr-x. 1 root  root      1320 Sep 13 13:58 stresstest.sh
[root@rhevm2017 gregs]# 
[root@rhevm2017 gregs]# 
[root@rhevm2017 gregs]# more datetime.py
#!/usr/bin/python
import time
print "Current date and time " + time.strftime("%c")
[root@rhevm2017 gregs]# 

No way - did I really stumble across a conflict because I don't know my butt from a hole in the ground with python?

[root@rhevm2017 gregs]# 
[root@rhevm2017 gregs]# mv datetime.py greg-datetime.py
[root@rhevm2017 gregs]# mv datetime.pyc greg-datetime.pyc
[root@rhevm2017 gregs]# 
[root@rhevm2017 gregs]# 
[root@rhevm2017 gregs]# python -c 'import psycopg2'
[root@rhevm2017 gregs]#