PythonExtensionsCollection 0.2.0__py3-none-any.whl → 0.13.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. PythonExtensionsCollection/Comparison/CComparison.py +341 -0
  2. PythonExtensionsCollection/Comparison/__init__.py +13 -0
  3. PythonExtensionsCollection/File/CFile.py +326 -106
  4. PythonExtensionsCollection/File/__init__.py +1 -1
  5. PythonExtensionsCollection/Folder/CFolder.py +460 -0
  6. PythonExtensionsCollection/Folder/__init__.py +13 -0
  7. PythonExtensionsCollection/PythonExtensionsCollection.pdf +0 -0
  8. PythonExtensionsCollection/String/CString.py +128 -344
  9. PythonExtensionsCollection/String/__init__.py +1 -1
  10. PythonExtensionsCollection/Utils/CUtils.py +77 -74
  11. PythonExtensionsCollection/Utils/__init__.py +1 -1
  12. PythonExtensionsCollection/__init__.py +1 -1
  13. PythonExtensionsCollection/version.py +23 -0
  14. {PythonExtensionsCollection-0.2.0.dist-info → PythonExtensionsCollection-0.13.0.dist-info}/METADATA +57 -44
  15. PythonExtensionsCollection-0.13.0.dist-info/RECORD +18 -0
  16. {PythonExtensionsCollection-0.2.0.dist-info → PythonExtensionsCollection-0.13.0.dist-info}/WHEEL +1 -1
  17. PythonExtensionsCollection/doc/.buildinfo +0 -4
  18. PythonExtensionsCollection/doc/File.html +0 -315
  19. PythonExtensionsCollection/doc/String.html +0 -590
  20. PythonExtensionsCollection/doc/Utils.html +0 -209
  21. PythonExtensionsCollection/doc/_modules/PythonExtensionsCollection/File/CFile.html +0 -960
  22. PythonExtensionsCollection/doc/_modules/PythonExtensionsCollection/String/CString.html +0 -1221
  23. PythonExtensionsCollection/doc/_modules/PythonExtensionsCollection/Utils/CUtils.html +0 -431
  24. PythonExtensionsCollection/doc/_modules/index.html +0 -106
  25. PythonExtensionsCollection/doc/_sources/File.rst.txt +0 -28
  26. PythonExtensionsCollection/doc/_sources/String.rst.txt +0 -28
  27. PythonExtensionsCollection/doc/_sources/Utils.rst.txt +0 -28
  28. PythonExtensionsCollection/doc/_sources/additional_doc/Introduction.rst.txt +0 -365
  29. PythonExtensionsCollection/doc/_sources/index.rst.txt +0 -27
  30. PythonExtensionsCollection/doc/_static/_sphinx_javascript_frameworks_compat.js +0 -134
  31. PythonExtensionsCollection/doc/_static/alabaster.css +0 -701
  32. PythonExtensionsCollection/doc/_static/basic.css +0 -930
  33. PythonExtensionsCollection/doc/_static/custom.css +0 -1
  34. PythonExtensionsCollection/doc/_static/doctools.js +0 -264
  35. PythonExtensionsCollection/doc/_static/documentation_options.js +0 -14
  36. PythonExtensionsCollection/doc/_static/file.png +0 -0
  37. PythonExtensionsCollection/doc/_static/jquery-3.6.0.js +0 -10881
  38. PythonExtensionsCollection/doc/_static/jquery.js +0 -2
  39. PythonExtensionsCollection/doc/_static/language_data.js +0 -199
  40. PythonExtensionsCollection/doc/_static/minus.png +0 -0
  41. PythonExtensionsCollection/doc/_static/plus.png +0 -0
  42. PythonExtensionsCollection/doc/_static/pygments.css +0 -82
  43. PythonExtensionsCollection/doc/_static/searchtools.js +0 -531
  44. PythonExtensionsCollection/doc/_static/underscore-1.13.1.js +0 -2042
  45. PythonExtensionsCollection/doc/_static/underscore.js +0 -6
  46. PythonExtensionsCollection/doc/additional_doc/Introduction.html +0 -365
  47. PythonExtensionsCollection/doc/genindex.html +0 -292
  48. PythonExtensionsCollection/doc/index.html +0 -123
  49. PythonExtensionsCollection/doc/objects.inv +0 -0
  50. PythonExtensionsCollection/doc/py-modindex.html +0 -138
  51. PythonExtensionsCollection/doc/search.html +0 -127
  52. PythonExtensionsCollection/doc/searchindex.js +0 -1
  53. PythonExtensionsCollection-0.2.0.dist-info/RECORD +0 -48
  54. {PythonExtensionsCollection-0.2.0.dist-info → PythonExtensionsCollection-0.13.0.dist-info}/LICENSE +0 -0
  55. {PythonExtensionsCollection-0.2.0.dist-info → PythonExtensionsCollection-0.13.0.dist-info}/top_level.txt +0 -0
@@ -1,106 +0,0 @@
1
-
2
- <!DOCTYPE html>
3
-
4
- <html lang="en">
5
- <head>
6
- <meta charset="utf-8" />
7
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
- <title>Overview: module code &#8212; Python Extensions Collection documentation</title>
9
- <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
10
- <link rel="stylesheet" type="text/css" href="../_static/alabaster.css" />
11
- <script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
12
- <script src="../_static/jquery.js"></script>
13
- <script src="../_static/underscore.js"></script>
14
- <script src="../_static/_sphinx_javascript_frameworks_compat.js"></script>
15
- <script src="../_static/doctools.js"></script>
16
- <link rel="index" title="Index" href="../genindex.html" />
17
- <link rel="search" title="Search" href="../search.html" />
18
-
19
- <link rel="stylesheet" href="../_static/custom.css" type="text/css" />
20
-
21
-
22
- <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
23
-
24
- </head><body>
25
-
26
-
27
- <div class="document">
28
- <div class="documentwrapper">
29
- <div class="bodywrapper">
30
-
31
-
32
- <div class="body" role="main">
33
-
34
- <h1>All modules for which code is available</h1>
35
- <ul><li><a href="PythonExtensionsCollection/File/CFile.html">PythonExtensionsCollection.File.CFile</a></li>
36
- <li><a href="PythonExtensionsCollection/String/CString.html">PythonExtensionsCollection.String.CString</a></li>
37
- <li><a href="PythonExtensionsCollection/Utils/CUtils.html">PythonExtensionsCollection.Utils.CUtils</a></li>
38
- </ul>
39
-
40
- </div>
41
-
42
- </div>
43
- </div>
44
- <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
45
- <div class="sphinxsidebarwrapper">
46
- <h1 class="logo"><a href="../index.html">Python Extensions Collection</a></h1>
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
- <h3>Navigation</h3>
56
- <ul>
57
- <li class="toctree-l1"><a class="reference internal" href="../additional_doc/Introduction.html">1. Introduction</a></li>
58
- <li class="toctree-l1"><a class="reference internal" href="../additional_doc/Introduction.html#examples">2. Examples</a></li>
59
- <li class="toctree-l1"><a class="reference internal" href="../String.html">3. CString module</a></li>
60
- <li class="toctree-l1"><a class="reference internal" href="../Utils.html">4. CUtils module</a></li>
61
- <li class="toctree-l1"><a class="reference internal" href="../File.html">5. CFile module</a></li>
62
- </ul>
63
-
64
- <div class="relations">
65
- <h3>Related Topics</h3>
66
- <ul>
67
- <li><a href="../index.html">Documentation overview</a><ul>
68
- </ul></li>
69
- </ul>
70
- </div>
71
- <div id="searchbox" style="display: none" role="search">
72
- <h3 id="searchlabel">Quick search</h3>
73
- <div class="searchformwrapper">
74
- <form class="search" action="../search.html" method="get">
75
- <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
76
- <input type="submit" value="Go" />
77
- </form>
78
- </div>
79
- </div>
80
- <script>document.getElementById('searchbox').style.display = "block"</script>
81
-
82
-
83
-
84
-
85
-
86
-
87
-
88
-
89
- </div>
90
- </div>
91
- <div class="clearer"></div>
92
- </div>
93
- <div class="footer">
94
- &copy;2022, Queckenstedt Holger (XC-CT/ECA3).
95
-
96
- |
97
- Powered by <a href="http://sphinx-doc.org/">Sphinx 5.0.0</a>
98
- &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
99
-
100
- </div>
101
-
102
-
103
-
104
-
105
- </body>
106
- </html>
@@ -1,28 +0,0 @@
1
- .. Copyright 2020-2022 Robert Bosch Car Multimedia GmbH
2
-
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
-
7
- http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
13
- limitations under the License.
14
-
15
-
16
- .. rst-class:: dl-parameters
17
-
18
- .. role:: aspect (emphasis)
19
- .. role:: sep (strong)
20
-
21
-
22
- CFile module
23
- ------------
24
-
25
- .. automodule:: PythonExtensionsCollection.File.CFile
26
- :members:
27
- :undoc-members:
28
- :show-inheritance:
@@ -1,28 +0,0 @@
1
- .. Copyright 2020-2022 Robert Bosch Car Multimedia GmbH
2
-
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
-
7
- http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
13
- limitations under the License.
14
-
15
-
16
- .. rst-class:: dl-parameters
17
-
18
- .. role:: aspect (emphasis)
19
- .. role:: sep (strong)
20
-
21
-
22
- CString module
23
- --------------
24
-
25
- .. automodule:: PythonExtensionsCollection.String.CString
26
- :members:
27
- :undoc-members:
28
- :show-inheritance:
@@ -1,28 +0,0 @@
1
- .. Copyright 2020-2022 Robert Bosch Car Multimedia GmbH
2
-
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
-
7
- http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
13
- limitations under the License.
14
-
15
-
16
- .. rst-class:: dl-parameters
17
-
18
- .. role:: aspect (emphasis)
19
- .. role:: sep (strong)
20
-
21
-
22
- CUtils module
23
- -------------
24
-
25
- .. automodule:: PythonExtensionsCollection.Utils.CUtils
26
- :members:
27
- :undoc-members:
28
- :show-inheritance:
@@ -1,365 +0,0 @@
1
- .. Copyright 2020-2022 Robert Bosch Car Multimedia GmbH
2
-
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
-
7
- http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
13
- limitations under the License.
14
-
15
- Introduction
16
- ------------
17
-
18
- The Python Extensions Collection package extends the functionality of Python by some useful functions
19
- that are not available in Python immediately.
20
-
21
- This covers for example string operations like normalizing a path or searching
22
- for parent directories within a path.
23
-
24
- The Python Extensions Collection contains several Python modules and every module has to be imported separately
25
- in case of the functions inside are needed.
26
-
27
- **Path normalization**
28
-
29
- It's not easy to handle paths - and especially the path separators - independend from the operating system.
30
-
31
- Under Linux it is obvious that single slashes are used as separator within paths. Whereas the Windows explorer
32
- uses single backslashes. In both operating systems web addresses contains single slashes as separator
33
- when displayed in web browsers.
34
-
35
- Using single backslashes within code - as content of string variables - is dangerous because the combination
36
- of a backslash and a letter can be interpreted as escape sequence - and this is maybe not the effect a user wants to have.
37
-
38
- To avoid unwanted escape sequences backslashes have to be masked (by the usage of two of them: ``\\``). But also this
39
- could not be the best solution because there are also applications (like the Windows explorer) that are not able to handle
40
- masked backslashes. They expect to get single backslashes within a path.
41
-
42
- Preparing a path for best usage within code also includes collapsing redundant separators and up-level references.
43
- Python already provides functions to do this, but the outcome (path contains slashes or backslashes) depends on the
44
- operating system. And like already mentioned above also under Windows backslashes might not be the preferred choice.
45
-
46
- It also has to be considered that redundant separators at the beginning of an address of a local network resource
47
- (like ``\\server.com``) and or inside an internet address (like ``https:\\server.com``) must **not** be collapsed!
48
- Unfortunately the Python function ``normpath`` does not consider this context.
49
-
50
- To give the user full control about the format of a path, independend from the operating system and independend if it's
51
- a local path, a path to a local network resource or an internet address, the function ``CString::NormalizePath()`` provides
52
- lot's of parameters to influence the result.
53
-
54
- **Module import**
55
-
56
- The modules of the Python Extension Collection and their methods can be accessed in the following ways:
57
-
58
- *CFile*
59
-
60
- .. code:: python
61
-
62
- from PythonExtensionsCollection.File.CFile import CFile
63
- ...
64
- sFile = r"%TMP%\File.txt"
65
- oFile = CFile(sFile)
66
-
67
- Please consider that ``oFile`` is an instance of the class ``CFile`` - *and not a file handle*.
68
-
69
- *CString*
70
-
71
- .. code:: python
72
-
73
- from PythonExtensionsCollection.String.CString import CString
74
- ...
75
- sPath = CString.NormalizePath(sPath)
76
- ...
77
- bAck = CString.StringFilter(sString, ...)
78
- ...
79
- sResult = CString.FormatResult(sMethod="", bSuccess=True, sResult="")
80
-
81
- *CUtils*
82
-
83
- .. code:: python
84
-
85
- from PythonExtensionsCollection.Utils.CUtils import *
86
- ...
87
- PrettyPrint(oData)
88
-
89
-
90
- Examples
91
- --------
92
-
93
- File access with CFile
94
- ======================
95
-
96
- The motivation for the CFile module contains two main topics:
97
-
98
- 1. More user control by introducing further parameter for file access functions. With high priority ``CFile`` enables the user
99
- to take care about that nothing existing is overwritten accidently.
100
- 2. Hide the file handles und use the mechanism of class variables to avoid access violations independend from
101
- the way different operation systems like Windows and Unix are handling this.
102
-
103
- This shortens the code, eases the implementation and makes tests (in which this module is used) more stable.
104
-
105
- *Define two variables with path and name of test files.*
106
-
107
- Under Windows:
108
-
109
- .. code:: python
110
-
111
- sFile_1 = r"%TMP%\CFile_TestFile_1.txt"
112
- sFile_2 = r"%TMP%\CFile_TestFile_2.txt"
113
-
114
- Or under Linux:
115
-
116
- .. code:: python
117
-
118
- sFile_1 = r"/tmp/CFile_TestFile_1.txt"
119
- sFile_2 = r"/tmp/CFile_TestFile_2.txt"
120
-
121
- *The first class instance:*
122
-
123
- .. code:: python
124
-
125
- oFile_1 = CFile(sFile_1)
126
-
127
- ``oFile_1`` is the instance of a class - *and not the file handle*. The file handle is hidden, the user has nothing to do with it.
128
-
129
- Every class instance can work with one single file only (during the complete instance lifetime) and has exclusive access to this file.
130
-
131
- No other class instance is allowed to use this file. Therefore the second line in the following code throws an exception:
132
-
133
- .. code:: python
134
-
135
- oFile_1_A = CFile(sFile_1)
136
- oFile_1_B = CFile(sFile_1)
137
-
138
- It's more save to implement in this way:
139
-
140
- .. code:: python
141
-
142
- try:
143
- oFile_1 = CFile(sFile_1)
144
- except Exception as reason:
145
- print(str(reason))
146
-
147
- For writing content to files two methods are available: ``Write()`` and ``Append()``.
148
-
149
- Using ``Write()`` causes the class to open the file for writing ('w') - in case of the file is not already opened for writing.
150
- Using ``Append()`` causes the class to open the file for appending ('a') - in case of the file is not already opened for appending.
151
-
152
- Switching between ``Write()`` and ``Append()`` causes an intermediate file handle ``close()`` internally!
153
-
154
- *Write some content to file:*
155
-
156
- .. code:: python
157
-
158
- bSuccess, sResult = oFile_1.Write("A B C")
159
- print(f"> sResult oFile_1.Write : '{sResult}' / bSuccess : {bSuccess}")
160
-
161
- Most of the functions returns at least ``bSuccess`` and ``sResult``.
162
-
163
- * ``bSuccess`` is ``True`` in case of no error occurred.
164
- * ``bSuccess`` is ``False`` in case of an error occurred.
165
- * ``bSuccess`` is ``None`` in case of a very fatal error occurred (exceptions).
166
- * ``sResult`` contains details about what happens during computation.
167
-
168
- It is possible now to continue with using ``oFile_1.Write("...")``; the content will be appended - as long as the file is still open for writing.
169
-
170
- Some functions close the file handle (e.g. ``ReadLines()``). Therefore sequences like ``oFile_1.Write("...")``, ``oFile_1.Readlines("...")``, ``oFile_1.Write("...")``
171
- should be avoided - because the ``Write()`` after the ``ReadLines()`` starts the file from scratch and the file content written by the previous ``Write()`` calls is lost.
172
-
173
- For appending content to a file use the function ``Append()``.
174
-
175
- *Append content to file:*
176
-
177
- .. code:: python
178
-
179
- bSuccess, sResult = oFile_1.Append("A B C")
180
-
181
- For reading content from a file use the function ``ReadLines()``.
182
-
183
- *Read from file:*
184
-
185
- .. code:: python
186
-
187
- listLines_1, bSuccess, sResult = oFile_1.ReadLines()
188
- for sLine in listLines_1:
189
- print(f"{sLine}")
190
-
191
- Additionally to ``bSuccess`` and ``sResult`` the function returnes a list of lines.
192
-
193
- Internally ``ReadLines()`` takes care about:
194
-
195
- * Closing the file - in case the file is still opened
196
- * Opening the file for reading
197
- * Reading the content line by line until the end of file is reached
198
- * Closing the file
199
-
200
- To avoid code like this
201
-
202
- .. code:: python
203
-
204
- for sLine in listLines_1:
205
- print(f"{sLine}")
206
-
207
- it is also possible to let ``ReadLines()`` do this:
208
-
209
- .. code:: python
210
-
211
- listLines_1, bSuccess, sResult = oFile_1.ReadLines(bToScreen=True)
212
-
213
- A function to read a single line from file only is not available, but it is possible to use some filter parameter of ``ReadLines()``
214
- to reduce the amount of content already during the file is read. This prevents the user from implementing further loops.
215
-
216
- Let's assume the following:
217
-
218
- * The file ``sFile_1`` contains empty lines
219
- * The file ``sFile_1`` contains also lines, that are commented out (with a hash '``#``' at the beginning)
220
- * We want ``ReadLines()`` to skip empty lines and lines that are commented out
221
-
222
- This can be imlemented in the following way.
223
-
224
- *Read a subset of file content:*
225
-
226
- .. code:: python
227
-
228
- listLines_1, bSuccess, sResult = oFile_1.ReadLines(bSkipBlankLines=True,
229
- sComment='#')
230
-
231
- It is a good practice to close file handles as soon as possible. Therefore ``CFile`` provides the possibility to do this explicitely.
232
-
233
- *Close a file handle:*
234
-
235
- .. code:: python
236
-
237
- bSuccess, sResult = oFile_1.Close()
238
-
239
- This makes sense in case of later again access to this file is needed.
240
-
241
- Additionally to that the file handle is closed implicitely:
242
-
243
- * in case of it is required (e.g. when switching between read and write access),
244
- * in case of the class instance is destoyed.
245
-
246
- Therefore an alternative to the ``Close()`` function is the deletion of the class instance:
247
-
248
- .. code:: python
249
-
250
- del oFile_1
251
-
252
- This makes sense in case of access to this file is not needed any more.
253
-
254
- It is recommended to prefer ``del`` (instead of ``Close()``) to avoid to keep too much not used objects for a too long length of time in memory.
255
-
256
- A file can be copied to another file.
257
-
258
- *Copy a file:*
259
-
260
- .. code:: python
261
-
262
- bSuccess, sResult = oFile_1.CopyTo(sFile_2)
263
-
264
- The destination (``sFile_2`` in the example above) can either be a full path and name of a file or the path only.
265
-
266
- It makes a difference if the destination file exists or not. The optional parameter ``bOverwrite`` controls the behavior of ``CopyTo()``.
267
-
268
- The default is that it is not allowed to overwrite an existing destination file: ``bOverwrite`` is ``False``. ``CopyTo()`` returns
269
- ``bSuccess = False`` in this case.
270
-
271
- In case the user want to allow ``CopyTo()`` to overwrite existing destination files, it has to be coded explicitely:
272
-
273
- .. code:: python
274
-
275
- bSuccess, sResult = oFile_1.CopyTo(sFile_2, bOverwrite=True)
276
-
277
- A file can be moved to another file.
278
-
279
- *Move a file:*
280
-
281
- .. code:: python
282
-
283
- bSuccess, sResult = oFile_1.MoveTo(sFile_2)
284
-
285
- Also ``MoveTo()`` supports ``bOverwrite``. The behavior is the same as ``CopyTo()``.
286
-
287
- A file can be deleted.
288
-
289
- *Delete a file:*
290
-
291
- .. code:: python
292
-
293
- bSuccess, sResult = oFile_1.Delete()
294
-
295
- It is possible to distinguish between two different motivations to delete a file:
296
-
297
- 1. *Explicitely do a deletion*
298
-
299
- This requires that the file to be deleted, does exist.
300
-
301
- 2. *Making sure only that the files does not exist*
302
-
303
- In this case it doesn't matter that maybe there is nothing to delete because the file already does not exist.
304
-
305
- The optional parameter ``bConfirmDelete`` controls this behavior.
306
-
307
- Default is that ``Delete()`` requires an existing file to delete:
308
-
309
- .. code:: python
310
-
311
- bSuccess, sResult = oFile_1.Delete(bConfirmDelete=True)
312
-
313
- In case of the file does not exist, ``Delete()`` returns ``bSuccess = False``.
314
-
315
- ``Delete()`` also returns ``bSuccess = False|None`` in case of an existing file cannot be deleted (e.g. because of an access violation).
316
-
317
- If it doesn't matter it the file exists or not, it has to be coded explicitely:
318
-
319
- .. code:: python
320
-
321
- bSuccess, sResult = oFile_1.Delete(bConfirmDelete=False)
322
-
323
- In this case ``Delete()`` only returns ``bSuccess = False|None`` in case of an existing file cannot be deleted (e.g. because of an access violation).
324
-
325
- **Avoid access violations**
326
-
327
- Like already mentioned above every instance of ``CFile`` has an exclusive access to it's own file.
328
-
329
- Only in case of ``CopyTo()`` and ``MoveTo()`` other files are involved: the destination files.
330
-
331
- To avoid access violations it is not possible to copy or move a file to another file, that is under access of another instance of ``CFile``.
332
-
333
- In the following example ``oFile_1.CopyTo(sFile_2)`` returns ``bSuccess = False`` because ``sFile_2`` is already in access by ``oFile_2``.
334
-
335
- .. code:: python
336
-
337
- oFile_1 = CFile(sFile_1)
338
- bSuccess, sResult = oFile_1.Write("A B C")
339
-
340
- oFile_2 = CFile(sFile_2)
341
- listLines_2, bSuccess, sResult = oFile_2.ReadLines()
342
-
343
- bSuccess, sResult = oFile_1.CopyTo(sFile_2)
344
-
345
- del oFile_1
346
- del oFile_2
347
-
348
- The solution is to delete the class instances as early as possible.
349
-
350
- In the following example the copying is successful:
351
-
352
- .. code:: python
353
-
354
- oFile_1 = CFile(sFile_1)
355
- bSuccess, sResult = oFile_1.Write("A B C")
356
-
357
- oFile_2 = CFile(sFile_2)
358
- listLines_2, bSuccess, sResult = oFile_2.ReadLines()
359
- del oFile_2
360
-
361
- bSuccess, sResult = oFile_1.CopyTo(sFile_2)
362
- del oFile_1
363
-
364
-
365
- (*Last update: 26.01.2022*)
@@ -1,27 +0,0 @@
1
- .. Copyright 2020-2022 Robert Bosch Car Multimedia GmbH
2
-
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
-
7
- http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
13
- limitations under the License.
14
-
15
- .. The Python Extensions Collection documentation master file
16
-
17
- API Contents
18
- ------------
19
-
20
- .. toctree::
21
- :numbered:
22
- :maxdepth: 4
23
-
24
- ./additional_doc/Introduction.rst
25
- ./String.rst
26
- ./Utils.rst
27
- ./File.rst