faircloth-lab / phyluce

software for UCE (and general) phylogenomics
http://phyluce.readthedocs.org/
Other
76 stars 48 forks source link

Phyluce_assembly_explode_get_fastas_file UnboundLocalError #318

Closed louisfnastasi closed 8 months ago

louisfnastasi commented 9 months ago

When I run the following command:

phyluce_assembly_explode_get_fastas_file \ --input all-taxa-incomplete.fasta \ --output exploded-fastas \ --by-taxon

I continue to receive this error:

Traceback (most recent call last): File "/storage/home/lfn5093/.conda/envs/phyluce-1.7.2/bin/phyluce_assembly_explode_get_fastas_file", line 88, in main() File "/storage/home/lfn5093/.conda/envs/phyluce-1.7.2/bin/phyluce_assembly_explode_get_fastas_file", line 58, in main response = input( UnboundLocalError: local variable 'input' referenced before assignment

Any idea as to why? The command is directly pasted from Tutorial I (I've made sure the files and directory are correct) but it still won't run. Is this a simple syntax issue?

brantfaircloth commented 9 months ago

I think the issue is that when you split lines (when inputting to the command line), you need to separate those lines with a slash, like so:

phyluce_assembly_explode_get_fastas_file \
--input all-taxa-incomplete.fasta \
--output exploded-fastas \
--by-taxon
louisfnastasi commented 9 months ago

Odd, I do have slashes in my script - not sure why they didn't copy. Maybe my IDE reformats text when I copy it? Here's a screenshot rather than copying the text itself:

image
brantfaircloth commented 9 months ago

I'm not sure what the problem is. You can move everything onto a single line - that should remove any issue (the error message is the giveaway that something w/ formatting is wrong here).

louisfnastasi commented 9 months ago

Upon closer inspection, it looks like the "input" parameter in the command conflicts with python's built in "input" function where it expects input from the user or terminal. Any ideas as to how this may be overwritten or otherwise bypassed?

brantfaircloth commented 9 months ago

That's not quite the issue (--input and input() are two different things). Ensure that the directory does not exist before running.

That said, there is a small bug in the code that causes problem when there is already a folder that exists to hold the output. That bug is popping up because it seems you already have an existing folder of results that might/will be overwritten.

brantfaircloth commented 9 months ago

The issue is fixed with the update above, although the fix is not available in a release (at this point). You should still be able to avoid the issue by making sure your output directory does not exist before running phyluce_assembly_explode_get_fastas_file.