AttributeError: 'Session' object has no attribute 'time'

Hi all Scampsters.

I now get this strange message "AttributeError: ‘Session’ object has no attribute ‘time’ ", even after reinstalling the scamp package. It shows on any code. It was working great earlier. I might have moved something by accident but even then, re-installing the package should do the trick, no ?
Any idea on how to fix this? I’m on mac os10.12.

Thanks for you help !

Here is a simple code test :

from scamp import *

s = Session()

violin = s.new_part(“Violin”)

violin.play_note(61,1,1)

And here is the shell message:

%Run -c $EDITOR_CONTENT
WARNING:root:python-rtmidi was not found; streaming midi input / output will not be available.
Using preset Violin LP3 for Violin
Traceback (most recent call last):
File “”, line 7, in
File “/Users/Gabriel/Library/Python/3.10/lib/python/site-packages/scamp/instruments.py”, line 454, in play_note
self._do_play_note(clock, pitch, volume, length, properties,
File “/Users/Gabriel/Library/Python/3.10/lib/python/site-packages/scamp/instruments.py”, line 545, in _do_play_note
note_handle = self.start_note(
File “/Users/Gabriel/Library/Python/3.10/lib/python/site-packages/scamp/instruments.py”, line 642, in start_note
“start_time_stamp”: TimeStamp(clock),
File “/Users/Gabriel/Library/Python/3.10/lib/python/site-packages/clockblocks/clock.py”, line 1562, in init
self.time_in_master = clock.time_in_master() if clock is not None else self.wall_time
File “/Users/Gabriel/Library/Python/3.10/lib/python/site-packages/clockblocks/clock.py”, line 410, in time_in_master
return self.master.time()
AttributeError: ‘Session’ object has no attribute ‘time’

This is a pretty weird error!

First, double-check that this causes an error:

from scamp import *

print(Session().time())

Then try running:

from scamp import *

print(dir(Session()))

What does it print out?

Thanks a lot Mark.
So "from scamp import *

print(Session().time())" does produce the same error.

And "from scamp import *

print(dir(Session()))"

prints:

[‘abstractmethods’, ‘class’, ‘delattr’, ‘dict’, ‘dir’, ‘doc’, ‘eq’, ‘format’, ‘ge’, ‘getattribute’, ‘gt’, ‘hash’, ‘init’, ‘init_subclass’, ‘le’, ‘lt’, ‘module’, ‘ne’, ‘new’, ‘reduce’, ‘reduce_ex’, ‘repr’, ‘setattr’, ‘sizeof’, ‘str’, ‘subclasshook’, ‘weakref’, ‘_abc_impl’, ‘_advance_tempo_map_to_beat’, ‘_apply_tempo_function’, ‘_catch_up_children’, ‘_child_tree_string’, ‘_children’, ‘_complete_timestamp_data’, ‘_decoder_object_hook’, ‘_default_spelling_policy’, ‘_dormant’, ‘_encoder_default’, ‘_envelope_loop_or_function’, ‘_extend_looping_envelopes_if_needed’, ‘_fast_forward_goal’, ‘_from_dict’, ‘_get_absolute_time_increments_from_beat_increments’, ‘_get_part_name_count’, ‘_get_time_increments_from_beat_increments’, ‘_get_wait_end_beat’, ‘_handle_next_wakeup_call’, ‘_instruments’, ‘_killed’, ‘_last_sleep_time’, ‘_listeners’, ‘_log_processing_time’, ‘_loop_segments’, ‘_name_and_number_from_key’, ‘_name_to_js_key_code’, ‘_pool’, ‘_pool_semaphore’, ‘_priority_counter’, ‘_queue’, ‘_queue_has_wakeup_call’, ‘_queue_lock’, ‘_remove_wakeup_call_from_parent_queue’, ‘_resolve_preset_from_name’, ‘_resolve_synchronization_policy’, ‘_resolve_time_stamp’, ‘_run_in_pool’, ‘_running_behind_warning_count’, ‘_start_time’, ‘_synchronization_policy’, ‘_synchronize_children’, ‘_timing_policy’, ‘_to_dict’, ‘_transcriptions_in_progress’, ‘_uppers_to_lowers’, ‘_wait_event’, ‘_wait_for_child_to_finish_processing’, ‘_wait_for_children_to_finish_processing’, ‘_wait_in_parent’, ‘_wait_keeper’, ‘_woken_early’, ‘absolute_beat_length’, ‘absolute_rate’, ‘absolute_tempo’, ‘add_instrument’, ‘alive’, ‘apply_beat_length_function’, ‘apply_rate_function’, ‘apply_tempo_function’, ‘beat’, ‘beat_length’, ‘children’, ‘default_audio_driver’, ‘default_soundfont’, ‘default_spelling_policy’, ‘descendants’, ‘duplicate’, ‘extract_absolute_tempo_envelope’, ‘fast_forward_in_beats’, ‘fast_forward_in_time’, ‘fast_forward_to_beat’, ‘fast_forward_to_time’, ‘fork’, ‘fork_unsynchronized’, ‘get_available_midi_input_devices’, ‘get_available_midi_output_devices’, ‘get_instrument_by_name’, ‘inheritance’, ‘instruments’, ‘is_fast_forwarding’, ‘is_master’, ‘is_transcribing’, ‘iterate_all_relatives’, ‘iterate_descendants’, ‘iterate_inheritance’, ‘json_dumps’, ‘json_loads’, ‘kill’, ‘load_from_json’, ‘log_processing_time’, ‘master’, ‘name’, ‘new_midi_part’, ‘new_osc_part’, ‘new_part’, ‘new_silent_part’, ‘parent’, ‘parent_offset’, ‘pop_instrument’, ‘print_available_midi_input_devices’, ‘print_available_midi_output_devices’, ‘print_default_soundfont_presets’, ‘print_family_tree’, ‘priority’, ‘rate’, ‘register_keyboard_listener’, ‘register_midi_listener’, ‘register_mouse_listener’, ‘register_note’, ‘register_osc_listener’, ‘release_from_suspension’, ‘remove_keyboard_listener’, ‘remove_midi_listener’, ‘remove_mouse_listener’, ‘remove_osc_listener’, ‘rouse_and_hold’, ‘run_as_server’, ‘save_to_json’, ‘set_beat_length_target’, ‘set_beat_length_targets’, ‘set_rate_target’, ‘set_rate_targets’, ‘set_tempo_target’, ‘set_tempo_targets’, ‘start_transcribing’, ‘stop_logging_processing_time’, ‘stop_tempo_loop_or_function’, ‘stop_transcribing’, ‘synchronization_policy’, ‘tempo’, ‘tempo_history’, ‘time_in_master’, ‘time_stamp_data’, ‘timing_policy’, ‘transcriptions_in_progress’, ‘use_absolute_timing_policy’, ‘use_mixed_timing_policy’, ‘use_relative_timing_policy’, ‘wait’, ‘wait_for_children_to_finish’, ‘wait_forever’]

So, I fixed it for the moment by copying the time function from https://git.sr.ht/~marcevanstein/clockblocks/tree/master/item/clockblocks/clock.py into my own clock.py file. Still, I find it strange that the reinstall did not fixed it :confused:

Thanks again for the help Mark !

odd… You might try a pip3 install --upgrade clockblocks

1 Like