using fireworks with python3 : use of basestring

Hi,

I’m running fireworks with python3 since my code is written in python3 (I’m a newbie in the python world, so I have started with the last version).

Everything runs fine, but I ran into a problem by accident (running qlaunch on a system with no queue system) :

Traceback (most recent call last):

File “/usr/lib/python3.4/site-packages/fireworks/user_objects/queue_adapters/common_adapter.py”, line 194, in submit_to_queue

p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

File “/usr/lib64/python3.4/subprocess.py”, line 859, in init

restore_signals, start_new_session)

File “/usr/lib64/python3.4/subprocess.py”, line 1457, in _execute_child

raise child_exception_type(errno_num, err_msg)

FileNotFoundError: [Errno 2] No such file or directory: ‘sbatch’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File “/usr/lib/python3.4/site-packages/fireworks/queue/queue_launcher.py”, line 124, in launch_rocket_to_queue

reservation_id = qadapter.submit_to_queue(SUBMIT_SCRIPT_NAME)

File “/usr/lib/python3.4/site-packages/fireworks/user_objects/queue_adapters/common_adapter.py”, line 222, in submit_to_queue

.format(submit_cmd))

File “/usr/lib/python3.4/site-packages/fireworks/utilities/fw_utilities.py”, line 118, in log_exception

return log_fancy(m_logger, msgs, ‘error’, add_traceback=True)

File “/usr/lib/python3.4/site-packages/fireworks/utilities/fw_utilities.py”, line 97, in log_fancy

if isinstance(msgs, basestring):

NameError: name ‘basestring’ is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File “/usr/bin/qlaunch”, line 6, in

qlaunch()

File “/usr/lib/python3.4/site-packages/fireworks/scripts/qlaunch_run.py”, line 173, in qlaunch

do_launch(args)

File “/usr/lib/python3.4/site-packages/fireworks/scripts/qlaunch_run.py”, line 55, in do_launch

args.launch_dir, args.reserve, args.loglvl, False)

File “/usr/lib/python3.4/site-packages/fireworks/queue/queue_launcher.py”, line 132, in launch_rocket_to_queue

log_exception(l_logger, ‘Error writing/submitting queue script!’)

File “/usr/lib/python3.4/site-packages/fireworks/utilities/fw_utilities.py”, line 118, in log_exception

return log_fancy(m_logger, msgs, ‘error’, add_traceback=True)

File “/usr/lib/python3.4/site-packages/fireworks/utilities/fw_utilities.py”, line 97, in log_fancy

if isinstance(msgs, basestring):

NameError: name ‘basestring’ is not defined

type basestring no more exists in python3. I have found 2 uses of basestring in fireworks

grep basestring (find /lib/python3.4/site-packages/fireworks/ -type f -name ‘*.py’)

/lib/python3.4/site-packages/fireworks/queue/queue_adapter.py: if isinstance(command, basestring):

/lib/python3.4/site-packages/fireworks/utilities/fw_utilities.py: if isinstance(msgs, basestring):

Maybe You could fix this to improve compatibility with python3 ?

Cheers,
David

Hi David

Thanks for reporting this. The basestring should have been fixed very recently in the latest release (v1.3.6).

Best,

Anubhav

···

On Wednesday, September 7, 2016 at 6:44:14 AM UTC-7, [email protected] wrote:

Hi,

I’m running fireworks with python3 since my code is written in python3 (I’m a newbie in the python world, so I have started with the last version).

Everything runs fine, but I ran into a problem by accident (running qlaunch on a system with no queue system) :

Traceback (most recent call last):

File “/usr/lib/python3.4/site-packages/fireworks/user_objects/queue_adapters/common_adapter.py”, line 194, in submit_to_queue

p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

File “/usr/lib64/python3.4/subprocess.py”, line 859, in init

restore_signals, start_new_session)

File “/usr/lib64/python3.4/subprocess.py”, line 1457, in _execute_child

raise child_exception_type(errno_num, err_msg)

FileNotFoundError: [Errno 2] No such file or directory: ‘sbatch’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File “/usr/lib/python3.4/site-packages/fireworks/queue/queue_launcher.py”, line 124, in launch_rocket_to_queue

reservation_id = qadapter.submit_to_queue(SUBMIT_SCRIPT_NAME)

File “/usr/lib/python3.4/site-packages/fireworks/user_objects/queue_adapters/common_adapter.py”, line 222, in submit_to_queue

.format(submit_cmd))

File “/usr/lib/python3.4/site-packages/fireworks/utilities/fw_utilities.py”, line 118, in log_exception

return log_fancy(m_logger, msgs, ‘error’, add_traceback=True)

File “/usr/lib/python3.4/site-packages/fireworks/utilities/fw_utilities.py”, line 97, in log_fancy

if isinstance(msgs, basestring):

NameError: name ‘basestring’ is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File “/usr/bin/qlaunch”, line 6, in

qlaunch()

File “/usr/lib/python3.4/site-packages/fireworks/scripts/qlaunch_run.py”, line 173, in qlaunch

do_launch(args)

File “/usr/lib/python3.4/site-packages/fireworks/scripts/qlaunch_run.py”, line 55, in do_launch

args.launch_dir, args.reserve, args.loglvl, False)

File “/usr/lib/python3.4/site-packages/fireworks/queue/queue_launcher.py”, line 132, in launch_rocket_to_queue

log_exception(l_logger, ‘Error writing/submitting queue script!’)

File “/usr/lib/python3.4/site-packages/fireworks/utilities/fw_utilities.py”, line 118, in log_exception

return log_fancy(m_logger, msgs, ‘error’, add_traceback=True)

File “/usr/lib/python3.4/site-packages/fireworks/utilities/fw_utilities.py”, line 97, in log_fancy

if isinstance(msgs, basestring):

NameError: name ‘basestring’ is not defined

type basestring no more exists in python3. I have found 2 uses of basestring in fireworks

grep basestring (find /lib/python3.4/site-packages/fireworks/ -type f -name ‘*.py’)

/lib/python3.4/site-packages/fireworks/queue/queue_adapter.py: if isinstance(command, basestring):

/lib/python3.4/site-packages/fireworks/utilities/fw_utilities.py: if isinstance(msgs, basestring):

Maybe You could fix this to improve compatibility with python3 ?

Cheers,
David