OpenGL configuration file, as well as unable to parse the file solution

Suggest to look at the question first
Do not guarantee that all people can use, to tell the truth, the computer is to need patience and perseverance, I have no talent, with three days.
I refer to “Computer Graphics Learning to Program (Using OpenGL and C ++)” here to talk about my files and problems.
Part of the file: https://github.com/Vnicy/Opengl-pathsetting
There is no GLM here, just go to Baidu GLM and put in the include file. (Too many files to upload)
After downloading and unzipping, open a newly created project.
Project – & gt; Property – & gt;
include directory include
brary directory select lib
a>
then se> linker ->; Add the following content to the input modification attached dependency (L is typed in lib with carriage return or semicolon, not identified by comma)
glew32.lib
glew32s.lib
glfw3.lib
soil2-debug.lib
glfw3dll.lib
OpenGL32.lib


Here are some of the problems I encountered :(I tested the first example in the book, which can also be downloaded, the resource address is listed in # 1)
1. Baidu SOIL2 didn’t make file
the solution: supporting resources in the book there is a complete soil file
resource address: https://www.epubit.com/bookDetails?id=UBb600b5af4598
Unable to resolve _imp_glClear@4 and _imp_glClearColor@16 are linkers -> I forgot to add an additional dependency to the input OpenGL32.lib


ah
4>ble to resolve glew initialization

4
4
:
:
:

AttributeError: module ‘os’ has no attribute ‘mknod’

AttributeError: module ‘OS’ has no attribute ‘mknod’
Today, I’m going to make a Python program for students to traverse the directory and count the homework submitted by students. I ran into this problem when I wanted to generate some test files from code, using os.mknod() Python on Windows does not support the mknodnction, because there is no node concept on Windows. with open("file_name.txt", a+) as fpwith open("file_name.txt", a+) as fp.

Attributeerror: ‘module’ object has no attribute ‘handlers’ — Python sub module import problem

You want to log using Python’s logging module and use RotatingFileHandler to process the log so that new log files are regenerated if they exceed the specified size.

>

import logging

logger = logging.getLogger('mylogger')
logger.setLevel(logging.INFO)

fh=logging.handlers.RotatingFileHandler('/tmp/test.log', mode = 'a', maxBytes=10240, backupCount=3, encoding='utf-8')

formatter = logging.Formatter('%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s - %(message)s')
fh.setFormatter(formatter)

logger.addHandler(fh)

logger.info('hello logging')
logger.warning('hello logging')
logger.error('hello logging')
logger.critical('hello logging')

run times error:

AttributeError: ‘module’ object has no attribute ‘handlers’


import logging
import logging.handlers
……

Rerun, the program output normally.

import Logging
import Logging
import Logging
import Logging
import Logging
import Logging
import Logging
import Logging
import Logging
import Logging
import Logging
Therefore, it is necessary to explicitly import the logging.handlers submodule in the access TAB.

but sometimes, when importing some package does not require additional action will automatically import its module, this is because the set of packages for these operations in py files. In other cases, something else you import might also import logging.handlers. Anyway, just make sure that before visiting

The corresponding submodule has already been imported. Sometimes a module that looks like a package is not, such as OS and OS.Path. OS is not a package, it just provides another module called path, which you can access through os.path.

Attribute


An error occurred when Python called the pydot.py file

AttributeError: module ‘OS’ has no attribute ‘errno’

why
No longer available in Python 3.7os. errno
Change the method
Change python3.7/ site-packages /pydot.py to import errno. Line 1863:

if e.errno == errno.ENOENT:
Note: If NameError: Name ‘errno’ is not defined, add import errno to pydot.py

module ‘os’ has no attribute ‘mknod’

The reason is that the code is running under Linux, but I am running under Windows. The ‘OS’ module in WIN is different, which does not have this property. Please modify it as follows:

os.mknod(os.path.join(args.save_path, "{}.lst".format(args.set)))

Instead, the final “w” is added according to your own needs.

open(os.path.join(args.save_path, "{}.lst".format(args.set)),"w")

How to use Python split() function (split array)

describe
Python split() slits a string by specifying a delimiter, and only splits the num substring if the parameter num has a specified value
grammar
Split () method syntax:

str.split(str="", num=string.count(str)).

parameter
STR – The delimiter, which defaults to all null characters, including Spaces, newlines (\n), tabs (\t), and so on. Num – number of splits.
The return value
Returns a list of partitioned strings.
The instance
The following example shows how to use the split() function:

#!/usr/bin/python

str = "Line1-abcdef \nLine2-abc \nLine4-abcd";
print str.split( );
print str.split(' ', 1 );

The output of the above example is as follows:

['Line1-abcdef', 'Line2-abc', 'Line4-abcd']
['Line1-abcdef', '\nLine2-abc \nLine4-abcd']

Fileexistserror: [winerror 183] cannot create a file when it already exists. File rename code attached

FileExistsError: [WinError 183] Unable to create a file while it already exists. Attached file rename code

problem:

FileExistsError: [WinError 183] Unable to create the file while it already exists.

file rename we may encounter this problem

> So what should we do about it?

> Here is my file



>
>
>
>
>
>

Then the code runs successfully:



ah

Solve the problem of prompt couldn’t find path to unrear library after installing unrear in Python

When we write Python scripts, since we use the Unrar library to extract RAR files, we always add:

from unrar import rarfile

If you are using an IDE like PyCharm on Windows, it will prompt you to import packages, or you can manually search for third-party libraries in the project Settings and install them.
It is recommended to use the PIP install rarfile and PIP install unrar commands to install these libraries if it is a Linux command environment.
However, you will notice that after doing the above, the Python program does not decompress and it will say Couldn’t find path to Unrar Library… An error caused the program to interrupt.
 
At that time, I was puzzled. I installed the library, why can’t I find it?
After several checks, from the Python – Unrar open source project official website learned that Python under the Unrar also relies on the RAR official library.
So, the next two Windows and Linux systems to introduce the solution steps.
Win:
1. Go to the RARLab official download library files, http://www.rarlab.com/rar/UnRARDLL.exe, and installation;
2. It is best to choose the default path for installation, usually in the C: Program Files (x86)\ Unrardll \ directory;
3. Then the important step is to add the environment variable, this computer (my computer) right click, properties, find advanced system Settings, advanced TAB click environment variable, in the system variable (note not user variable) in the new, variable name input UNRAR_LIB_PATH, must be exactly the same, the value of the variable should pay special attention to! If you are a 64-bit system, type C:\Program Files (x86)\ Unrardll \x64\ Unrar64.dll, if you are a 32-bit system, type C:\Program Files (x86)\ Unrard.dll.
4. Once you are sure to save your environment variables, restart your PyCharm with the same code and run it again without any errors. At this point the dependent libraries have been added to the system environment.
Linux needs to manually compile and generate the SO file itself, which is a bit more cumbersome:
1. In the same way, the first to download the Source file, but it’s not like a Win for you packaging good, you need to download the Source code: http://www.rarlab.com/rar/unrarsrc-5.4.5.tar.gz, namely RARLab website to download the list of UnRAR Source, you can download the latest version;
Make install-lib will automatically compile the library files. After the compilation is complete, use the make install-lib command to generate the libunrar.so file (usually under /usr/lib).
3. Finally, you still need to set the environment variable of your Linux system, find the profile file in the /etc/profile directory, which you can edit directly using the Vim /etc/profile command (even more convenient with WinSCP), add export UNRAR_LIB_PATH=/usr/lib/libunrar.so at the end of the profile, don’t put the comma in it. Save the variable successfully and then use the source /etc/profile command to make the variable effective.
4. If you run the py file again, you won’t get an error, at least you won’t get a warning that you can’t find the unrar library.
Sudo apt-get install g++ : sudo apt-get install g++ : sudo apt-get install g++ : sudo apt-get install g++ : sudo apt-get install
 
In conclusion, the normal order of installation should be to install the dependent libraries, configure the environment variables, and then PIP install unrar or import unrar libraries in the IDE. However, you can only make up for the error, and the final effect is the same.
References:
https://github.com/matiasb/python-unrar/blob/master/README.md
http://stackoverflow.com/questions/31834502/couldnt-find-path-to-unrar-library-in-linux
http://blog.csdn.net/big_talent/article/details/52367184