"No module named sets" ren'py - renpy

ok, I'm translating a game, a visual novel called "katawa shoujo", to be
precise the beta of this game which is not in Spanish
I got the beta files and moved them to ren'py (where it was created) but when running it inside ren'py I get this error:
File "C:\Users\Anthony\Desktop/game/ui_ingamemenu.rpy", line 1, in script
File "C:\Users\Anthony\Desktop/game/ui_ingamemenu.rpy", line 1, in script
File "C:\Users\Anthony\Desktop/game/ui_ingamemenu.rpy", line 2, in <module>
ImportError: No module named sets
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "renpy/bootstrap.py", line 326, in bootstrap
renpy.main.main()
File "renpy/main.py", line 515, in main
renpy.game.context().run(node)
File "C:\Users\Anthony\Desktop/game/ui_ingamemenu.rpy", line 1, in script
File "C:\Users\Anthony\Desktop/game/ui_ingamemenu.rpy", line 1, in script
File "renpy/ast.py", line 923, in execute
renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
File "renpy/python.py", line 2235, in py_exec_bytecode
exec(bytecode, globals, locals)
File "C:\Users\Anthony\Desktop/game/ui_ingamemenu.rpy", line 2, in <module>
ImportError: No module named sets
Windows-10-10.0.19041
Ren'Py 7.4.8.1895
Sat Sep 25 20:22:04 2021"
I suppose that the error is in the files of the program by the address of folders that it marks:
```While running game code:
File "C:\Users\Anthony\Desktop/game/ui_ingamemenu.rpy", line 1, in script"
but it marks that the user is "anthony" but my user is "A" ... I am very lazy with names xd
I don't have much experience so I would like you to help me, thank you
by the way, I use Atom to edit the scripts
If you need the files, I leave a download link for these:
https://www.mediafire.com/file/10ld61gyzipn0ar/Katawa_Shoujo_Beta_%2528Proyecto_de_traduccion%2529.rar/file?fbclid=IwAR14jNyYJbyyhaS6S2XEU2re5zD6Af2plIyhV40F9hH7ammfE_qaRIfJTVs

I would enter the file it is mentioning and remove the line importing set. I'm guessing this is a very old beta, right? In updated versions of Python you no longer need to import the "set" library, since it's automatically included (can be seen here).
If you don't have prior programming experience: Open the file named "ui_ingamemenu.rpy". On line 1 there should be a line that says "import sets". Just delete that. However, it's hard to know the exact issue without knowing the files you're working with.
Renpy doesn't display errors all at once, though; it stops at the first one it detects. So once you fix this, more may appear.
Buena suerte :)

A few things could cause this:
There could be something wrong with the name of one of your folders. Maybe a special symbol or character in the name of the folders?
Older versions of Python demanded you to import a library name sets, but this is now included in the standard library and can generate that error. Browse the code and look for something like: from sets import Set as set. If you find, delete or comment out this line. You can use ctrl + f to open the search bar.

Related

Biopython: SeqIO.parse() FileNotFoundError

I'm new in Bioinformatics and Biopython, so I have some difficulties with it.
I was reading the Biopython (SeqIO) documentation, but when I try to execute some SeqIO.parse() commands I get FileNotFoundError.
For example, I want to get "example.fasta" file (which I don't have it on my PC). I try to do it with this command:
for record in SeqIO.parse("example.fasta", "fasta"):
print(record.id)
But, all I get is FileNotFoundError: [Errno 2] No such file or directory
Can someone help me with this?
My understanding is that FileNotFoundError occurs when the code tries to open a file on your computer and does not find it.
This can happen either because you simply do not have this file, or you gave the name with a typo, or the path to the file is not correct (This is an important notion: the path to the file should be absolute, or relative to the current working directory (usually the one from which you executed the python script)).
As suggested in the comments to your question, you seem to be expecting SeqIO.parse to get the file for you. This is not the case. The first argument you give to this function (in the example "example.fasta") is the path to an existing file that you want to "parse", that is, interpret its information content and make this content available to the rest of your program in a convenient form.
So in order to get this example working, you first need to get a fasta file. If you do not already have one, you can download some manually from genbank, or find one in the biopython installation (if you installed it from source and know where the source code is located), for instance in Tests/Quality/example.fasta.

Failed to load a .bin.gz pre trained words2vecx

I'm trying to load the pre-trained words2vecs which I've found here (https://github.com/mmihaltz/word2vec-GoogleNews-vectors)
I used the following command:
model = gensim.models.KeyedVectors.load_word2vec_format('word2vec.bin.gz', binary=False)
And it throws this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/deeplearning/anaconda3/lib/python3.6/site-
packages/gensim/models/keyedvectors.py", line 193, in
load_word2vec_format
header = utils.to_unicode(fin.readline(), encoding=encoding)
File "/home/deeplearning/anaconda3/lib/python3.6/gzip.py", line 374,
in readline
return self._buffer.readline(size)
File "/home/deeplearning/anaconda3/lib/python3.6/_compression.py",
line 68, in readinto
data = self.read(len(byte_view))
File "/home/deeplearning/anaconda3/lib/python3.6/gzip.py", line 463,
in read
if not self._read_gzip_header():
File "/home/deeplearning/anaconda3/lib/python3.6/gzip.py", line 411,
in _read_gzip_header
raise OSError('Not a gzipped file (%r)' % magic)
OSError: Not a gzipped file (b've')
Because the error says, "Not a gzipped file", maybe the file has been inadvertently uncompressed, but still has the misleading .gzip extension? (Try renaming without .gzip, an loading that file.)
Because the filename includes .bin, it is likely a 'binary' style word2vec format. So the optional parameter may need to be binary=True.
The filename you're using, word2vec.bin.gz, does not match the filename at the link you provided, GoogleNews-vectors-negative300.bin.gz. This suggests other changes may have occurred that could cause problems.
The error also reports a 'magic number' (indicative prefix) from the file, b've', that looks like a bit of plain text, rather than the beginning of a real gzip file. You might want to look at the first few lines of the problem file, via something like head word2vec.bin.gz, to see if there are other indications of what it is (other than what you expect it to be).
for example, I chouse this file called "GoogleNews-vectors-negative300.bin.gz"
curl -o - https://s3.amazonaws.com/dl4j-distribution/GoogleNews-vectors-negative300.bin.gz | gunzip > ./GoogleNews-vectors-negative300.bin
Explanation:
represents the standard output. The standard output is what gets redirected by piping with |.
From man curl:
Specifying the output as '-' (a single dash) will force the output to
be done to stdout.
So for your situation, do the same for your file
for more information see the original solution:
issue and solution

How to use im2rec in MXnet to create my own dataset

In windows 10, I followed the step-by-step MXnet tutorial to use im2rec.py to create a dataset. I created a image list file like this:
integer_image_index \t label_index \t path_to_image
Next, I modified .txt to .lst.
Finally, I executed the command:
python im2rec.py --exts '.jpg' --train-ratio 0.41 --test-ratio 0.49 --recursive=True --pack-label=True D:\CUB_200_2011\data\image_label.lst D:\CUB_200_2011\CUB_200_2011\image
It is shown that "read no error", but the files created by the command like .lst and .rec are 0K, there is empty. I don't know why.
Please tell me what mistakes I made.
im2rec.py will print
read none error:(filename)
for any file that it can't load for whatever reason. Maybe some of the files you list aren't there or are empty? Or maybe the base path you've specified is wrong -- I notice you have the folder name CUB_200_2011 twice.

Adding new lang to ctags does not work

I am trying to add .volt extension to ctags language map, but it keep ignoring .volt file. This is content of my .ctags file:
--recurse=yes
--tag-relative=yes
--exclude=*.git*
--exclude=.DS_Store
--langmap=html:+.volt
When I do ctags --list-maps I will see .volt files being included in HTML:
HTML *.htm *.html *.volt
But still when I run ctags, it completely ignores .volt files. What I am doing wrong here?
The reasons for the unexpected behavior are most likely:
You are not using currently latest version 5.8 of Exuberant Ctags, but a version before 5.6.
Your .ctags file has --langmap=html:+.volt at end of file with no line termination.
Read the full story below on why I think those 2 reasons result in the unexpected behavior of Ctags on your computer.
I looked on your problem on Windows first using older version 5.5.4 of Exuberant Ctags installed with text editor UltraEdit and later also with version 5.8 downloaded directly from Exuberant Ctags project page.
I created a copy of one of my HTML projects with just 1 *.html file in parent directory of the test project, 3 *.html files in a subdirectory and two more *.html files also in the subdirectory with file extension changed from html to volt on both files which were just copies of 2 of the 3 *.html files in this subdirectory.
Next I created in parent directory of the project a ctags.conf file and copied the few lines you posted into this file. Additionally I inserted at top a line with --verbose as this is useful on looking for problems like that.
And last I copied ctags.exe (first v5.5.4, later v5.8) also into the test project directory just for making it easier to run it from command line.
I opened a command prompt window in test project directory and executed
ctags.exe -f test.tag --options=ctags.conf
I could see on verbose output that both *.volt files were opened for processing and created test.tag contained also all the tags from the 2 *.volt files, the same tags as the 2 *.html files from which the *.volt files were copied before.
So what could be the problem?
I'm not only familiar with HTML. My main job is programming in C/C++. Therefore I know about an often made mistake in C source code files on reading in text files: a wrong handling of text files with no line termination on last line of the file.
And I know that some text editors like gedit on Linux position the caret on Ctrl+End at beginning of the line below the last line in the file even when last line of the file does not have a line termination. The caret should be in this case positioned by the text editor at end of the string on last line instead of beginning on next line beyond real end of the file. This in my point of view wrong behavior lets a user of the text editor think that the text file has a line termination also on last line of the file even if this is not true.
So I thought that you have appended --langmap=html:+.volt perhaps at end of the file without a line termination and ctags.exe does not evaluate the line in this case because of not well done text file parsing in source code. Therefore I removed the line termination in ctags.conf from last line containing now only --langmap=html:+.volt
I executed same command line as before and AHA, both *.volt files are ignored because of unknown language.
This was the time as I downloaded version 5.8 of Ctags for Windows and copied it into the test project directory replacing executable of version 5.5.4.
I executed the command line again with not modified ctags.conf. Both *.volt files were processed by Ctags and test.tag contained again the tags from both *.volt files.
Appending on last line of file ctags.conf again a line termination and executing the command line once more did not result in a different output. So this bug with ignoring last line of the options file if no line termination present at end of the file is fixed in version 5.8 of Ctags.
I searched in Change Notes of Exuberant Ctags for last and found in changes notes block for ctags-5.6 (Mon May 29 2006)
Fixed problem reading last line of list file (-L) without final newline.
This is the confirmation for what I thought and could see. And of course the problem existed not only on reading the list file, but also on reading other text files like the options file, or C and Java files as the next line in the change notes informs
Fixed infinite loop that could occur on files without final newline [C, Java].
If the ctags binary is really universal ctags you need to put/link your config file here (man ctags-universal -> FILES):
~/.ctags.d/my-config.ctags
File extension .ctags is relevant.
In my case, I needed ctags to support the arduino (.ino) file type. Add --langmap=c++:+.ino to ~/.ctags.d/local.ctags (it only symlinks to ~/.ctags really).
Check:
ctags --list-maps | grep C++
C++ *.c++ *.cc *.cp *.cpp *.cxx *.h *.h++ *.hh *.hp *.hpp *.hxx *.inl *.C *.H *.CPP *.CXX *.ino
[...]
Notice *.ino at the end of the line listing known extensions.

32bit Python on Win7-64bit, import errors

When I try to launch ipython qtconsole from anywhere except my Python install dir, I get import errors. It seems to only work if I RUN->cmd.exe; cd C:\Users\me\python\Python27; ipython qtconsole;.
Ive tried Batch files, but it still seems if I don't run it within the context of my install dir, it just doesnt work. Always ipython-script that seems to be complaining. Here is the output...(this was from inside ipython with CurrentWorkingDirectory as my Desktop)
In [2]: !ipython qtconsole
Traceback (most recent call last):
File "C:\Users\me\python\Python27\ipython-script.py", line 770, in <module
>
load_entry_point('ipython==0.12', 'console_scripts', 'ipython')()
File "c:\cpd-svn\branches\qt-4.8\win32-12-01\install\bin\lib\site-packages\ipy
thon-0.12-py2.7.egg\IPython\frontend\terminal\ipapp.py", line 402, in launch_new
_instance
File "<string>", line 2, in initialize
File "c:\cpd-svn\branches\qt-4.8\win32-12-01\install\bin\lib\site-packages\ipy
thon-0.12-py2.7.egg\IPython\config\application.py", line 84, in catch_config_err
or
File "c:\cpd-svn\branches\qt-4.8\win32-12-01\install\bin\lib\site-packages\ipy
thon-0.12-py2.7.egg\IPython\frontend\terminal\ipapp.py", line 302, in initialize
File "<string>", line 2, in initialize
File "c:\cpd-svn\branches\qt-4.8\win32-12-01\install\bin\lib\site-packages\ipy
thon-0.12-py2.7.egg\IPython\config\application.py", line 84, in catch_config_err
or
File "c:\cpd-svn\branches\qt-4.8\win32-12-01\install\bin\lib\site-packages\ipy
thon-0.12-py2.7.egg\IPython\core\application.py", line 325, in initialize
File "c:\cpd-svn\branches\qt-4.8\win32-12-01\install\bin\lib\site-packages\ipy
thon-0.12-py2.7.egg\IPython\frontend\terminal\ipapp.py", line 297, in parse_comm
and_line
File "<string>", line 2, in parse_command_line
File "c:\cpd-svn\branches\qt-4.8\win32-12-01\install\bin\lib\site-packages\ipy
thon-0.12-py2.7.egg\IPython\config\application.py", line 84, in catch_config_err
or
File "c:\cpd-svn\branches\qt-4.8\win32-12-01\install\bin\lib\site-packages\ipy
thon-0.12-py2.7.egg\IPython\config\application.py", line 413, in parse_command_l
ine
File "<string>", line 2, in initialize_subcommand
File "c:\cpd-svn\branches\qt-4.8\win32-12-01\install\bin\lib\site-packages\ipy
thon-0.12-py2.7.egg\IPython\config\application.py", line 84, in catch_config_err
or
File "c:\cpd-svn\branches\qt-4.8\win32-12-01\install\bin\lib\site-packages\ipy
thon-0.12-py2.7.egg\IPython\config\application.py", line 349, in initialize_subc
ommand
File "c:\cpd-svn\branches\qt-4.8\win32-12-01\install\bin\lib\site-packages\ipy
thon-0.12-py2.7.egg\IPython\utils\importstring.py", line 40, in import_item
File "c:\cpd-svn\branches\qt-4.8\win32-12-01\install\bin\lib\site-packages\ipy
thon-0.12-py2.7.egg\IPython\frontend\qt\console\qtconsoleapp.py", line 30, in <m
odule>
File "c:\cpd-svn\branches\qt-4.8\win32-12-01\install\bin\lib\site-packages\ipy
thon-0.12-py2.7.egg\IPython\external\qt.py", line 42, in <module>
ImportError: Cannot import PySide >= 1.0.3 or PyQt4 >= 4.7
Like I said, it works perfectly fine from within my install dir, and I am 96% sure my ENV variables PATH,PYTHONPATH,PYTHONHOME are kosher. Ive gone from deleting them, to completely overloading them one directory at a time, with no change in results.
And I have made sure the Wow6432None Python entries exist (I tried not to pollute those).
Ipython is not the only module with errors like this (also with same solution), but this is definitely the most annoying (I can't launch qtconsole from Run Prompt!)
EDIT::I did dig up a start menu entry, and after changing the 'start in' property, I was able to launch qtconsole, but I still don't quite understand why this import is being performed relative to the current directory.
I believe it had to do with qtconsole dependencies living in locations not directly on my defined PATH, and I believe there were some conflicts in my modules search PATHS.
The easiest solution I found was to use the environment variable PYTHONPATH.
It has been a while since my original post, and several things have changed since then, but I believe the important factors were these:
-Be careful of 32bit python installed on 64bit windows.
-Utilize PYTHONPATH to include important sub-directories, such as '/install-dir/Lib' or any others.
If you still have trouble with your env variables, use absolute commands as a failsafe (wrap these up in a script that makes it easier to use),
C:\Users\johnny42\python\Python27\pythonw.exe
C:\Users\johnny42\python\Python27\ipython-script.py qtconsole
The above example should be on ONE LINE. Do not just copy and paste it.
I have Python 32 bit in my 64 bit Windows OS. Even I have a similar error "c:\cpd-svn\branches\qt-4.8\win32-12-01\install\bin". I do not know where is it being set. Can you please share your findings as to where Python is getting this path from? And which path it should be updated with?

Resources