openeventdata / petrarch

The Python-language successor to the TABARI event-data coding software.
MIT License
45 stars 24 forks source link

UnboundLocalError: local variable 'SentenceID' referenced before assignment #93

Closed dbl001 closed 9 years ago

dbl001 commented 9 years ago

In Vagrant virtual box:

David-Laxers-MacBook-Pro:eldiablo davidlaxer$ vagrant up /Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.3/lib/vagrant/pre-rubygems.rb:31: warning: Insecure world writable dir /Developer/NVIDIA/CUDA-6.5/bin in PATH, mode 040777 /Applications/Vagrant/embedded/gems/gems/bundler-1.6.2/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /Developer/NVIDIA/CUDA-6.5/bin in PATH, mode 040777 Bringing machine 'default' up with 'virtualbox' provider... ==> default: Checking if box 'ubuntu/trusty64' is up to date... ==> default: A newer version of the box 'ubuntu/trusty64' is available! You currently ==> default: have version '14.04'. The latest is version '20150817.0.0'. Run ==> default: vagrant box update to update. ==> default: Clearing any previously set forwarded ports... ==> default: Clearing any previously set network interfaces... ==> default: Preparing network interfaces based on configuration... default: Adapter 1: nat ==> default: Forwarding ports... default: 22 => 2222 (adapter 1) ==> default: Running 'pre-boot' VM customizations... ==> default: Booting VM... ==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 127.0.0.1:2222 default: SSH username: vagrant default: SSH auth method: private key default: Warning: Connection timeout. Retrying... default: Warning: Remote connection disconnect. Retrying... default: Warning: Remote connection disconnect. Retrying... default: Warning: Remote connection disconnect. Retrying... ==> default: Machine booted and ready! ==> default: Checking for guest additions in VM... ==> default: Mounting shared folders... default: /vagrant => /Users/davidlaxer/eldiablo ==> default: Machine already provisioned. Run vagrant provision or use the --provision ==> default: to force provisioning. Provisioners marked to run always will still run. David-Laxers-MacBook-Pro:eldiablo davidlaxer$ vagrant ssh /Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.3/lib/vagrant/pre-rubygems.rb:31: warning: Insecure world writable dir /Developer/NVIDIA/CUDA-6.5/bin in PATH, mode 040777 /Applications/Vagrant/embedded/gems/gems/bundler-1.6.2/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /Developer/NVIDIA/CUDA-6.5/bin in PATH, mode 040777 Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-32-generic x86_64)

197 packages can be updated. 102 updates are security updates.

Last login: Thu Aug 20 18:40:46 2015 from 10.0.2.2 vagrant@vagrant-ubuntu-trusty-64:~$ sudo apt-get update Ign http://downloads-distro.mongodb.org dist InRelease Ign http://archive.ubuntu.com trusty InRelease Ign http://security.ubuntu.com trusty-security InRelease Ign http://archive.ubuntu.com trusty-updates InRelease
Get:1 http://security.ubuntu.com trusty-security Release.gpg [933 B]
Hit http://downloads-distro.mongodb.org dist Release.gpg
Hit http://archive.ubuntu.com trusty Release.gpg Get:2 http://security.ubuntu.com trusty-security Release [63.5 kB]
Get:3 http://archive.ubuntu.com trusty-updates Release.gpg [933 B]
Hit http://downloads-distro.mongodb.org dist Release
Hit http://archive.ubuntu.com trusty Release
Get:4 http://archive.ubuntu.com trusty-updates Release [63.5 kB]
Get:5 http://security.ubuntu.com trusty-security/main Sources [92.2 kB]
Hit http://downloads-distro.mongodb.org dist/10gen amd64 Packages
Hit http://archive.ubuntu.com trusty/main Sources
Hit http://archive.ubuntu.com trusty/universe Sources
Get:6 http://security.ubuntu.com trusty-security/universe Sources [29.8 kB]
Hit http://archive.ubuntu.com trusty/main amd64 Packages
Get:7 http://security.ubuntu.com trusty-security/main amd64 Packages [333 kB]
Hit http://archive.ubuntu.com trusty/universe amd64 Packages
Hit http://archive.ubuntu.com trusty/main Translation-en
Hit http://archive.ubuntu.com trusty/universe Translation-en
Get:8 http://archive.ubuntu.com trusty-updates/main Sources [230 kB]
Get:9 http://security.ubuntu.com trusty-security/universe amd64 Packages [114 kB] Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Ign http://downloads-distro.mongodb.org dist/10gen Translation-en_US
Get:10 http://archive.ubuntu.com trusty-updates/universe Sources [134 kB]
Ign http://downloads-distro.mongodb.org dist/10gen Translation-en
Get:11 http://archive.ubuntu.com trusty-updates/main amd64 Packages [606 kB] Get:12 http://archive.ubuntu.com trusty-updates/universe amd64 Packages [309 kB] Hit http://archive.ubuntu.com trusty-updates/main Translation-en Hit http://archive.ubuntu.com trusty-updates/universe Translation-en Ign http://archive.ubuntu.com trusty/main Translation-en_US Ign http://archive.ubuntu.com trusty/universe Translation-en_US Fetched 1,976 kB in 5s (357 kB/s) Reading package lists... Done vagrant@vagrant-ubuntu-trusty-64:~$ ls phoenix_pipeline scraper src stanford_pipeline pipeline_stdout.log scraper_stdout.log stanford-corenlp stanford_stdout.log vagrant@vagrant-ubuntu-trusty-64:~$ ls .. ubuntu vagrant vagrant@vagrant-ubuntu-trusty-64:~$ ls phoenix_pipeline/ counter.txt oneaday_filter.pyc README.md timex.pyc docs PETRARCH.log requirements.txt uploader.py formatter.py PHOX_config.ini result_formatter.py uploader.pyc formatter.pyc PHOX_pipeline.log result_formatter.pyc utilities.py geolocation.py pipeline.py scraper_connection.py utilities.pyc geolocation.pyc pipeline_sched.py scraper_connection.pyc LICENSE postprocess.py source_keys.txt oneaday_filter.py postprocess.pyc timex.py vagrant@vagrant-ubuntu-trusty-64:~$ cd ../ vagrant@vagrant-ubuntu-trusty-64:/home$ ls ubuntu vagrant vagrant@vagrant-ubuntu-trusty-64:/home$ cd vagrant/phoenix_pipeline/

vagrant@vagrant-ubuntu-trusty-64:~/phoenix_pipeline$ sudo !! sudo python pipeline.py

Requires eGenix.com mx Base Distribution http://www.egenix.com/products/python/mxBase/ Found a config file in working directory

PHOX.pipeline run: 2015-08-21 14:01:24.814406 Date string: 20150820 Total number of stories: 8708 Running Mongo.formatter.py Running PETRARCH and returning output.

new_actor_length = 0 stop_on_error = False write_actor_root = False write_actor_text = False require_dyad = True code-by-sentence True pause_by_sentence False pause_by_story False Comma-delimited clause elimination: Initial : deactivated Internal: min = 2 max = 8 Terminal: min = 2 max = 8 Verb dictionary: CAMEO.verbpatterns.150430.txt Actor dictionaries: [u'Phoenix.Countries.actors.txt', u'Phoenix.International.actors.txt', u'Phoenix.MilNonState.actors.txt'] Agent dictionary: Phoenix.agents.txt Discard dictionary: Phoenix.discards.txt Issues dictionary: Phoenix.IssueCoding.txt NO INFO Traceback (most recent call last): File "pipeline.py", line 142, in run() File "pipeline.py", line 138, in run run_filter=file_details.oneaday_filter, version='v0.0.0') File "pipeline.py", line 97, in main parsed=True) File "/usr/local/lib/python2.7/dist-packages/petrarch/petrarch.py", line 2896, in run_pipeline updated_events = do_coding(events, 'TEMP') File "/usr/local/lib/python2.7/dist-packages/petrarch/petrarch.py", line 2677, in do_coding '{} has no parse information. Passing.'.format(SentenceID)) UnboundLocalError: local variable 'SentenceID' referenced before assignment vagrant@vagrant-ubuntu-trusty-64:~/phoenix_pipeline$ cd .. vagra NO INFO Traceback (most recent call last): File "pipeline.py", line 142, in run() File "pipeline.py", line 138, in run run_filter=file_details.oneaday_filter, version='v0.0.0') File "pipeline.py", line 97, in main parsed=True) File "/usr/local/lib/python2.7/dist-packages/petrarch/petrarch.py", line 2896, in run_pipeline updated_events = do_coding(events, 'TEMP') File "/usr/local/lib/python2.7/dist-packages/petrarch/petrarch.py", line 2677, in do_coding '{} has no parse information. Passing.'.format(SentenceID)) UnboundLocalError: local variable 'SentenceID' referenced before assignment

edited petrarch.py: added - SentenceID = ""

for sent in val['sents']: SentenceID = "" if 'parsed' in event_dict[key]['sents'][sent]:

$ python pipeline.py

...

NO INFO NO INFO NO INFO NO INFO NO INFO NO INFO NO INFO NO INFO NO INFO NO INFO NO INFO NO INFO NO INFO

...

Stories made it into Mongodb:

db.stories.count() 22736

dbl001 commented 9 years ago

T UnboundLocalError running in the ‘eldiablo’ Virtual box. The data that got into MongoDB was running native on OS X not in ‘eldiabl’ (e.g. - > db.stories.count() 8434 )

On Aug 31, 2015, at 1:22 PM, John Beieler notifications@github.com wrote:

Closed #93 https://github.com/openeventdata/petrarch/issues/93.

— Reply to this email directly or view it on GitHub https://github.com/openeventdata/petrarch/issues/93#event-397075265.