Re: Require Tolk.py assistance
Re: Require Tolk.py assistance @12Again, probably not, as you can't guarantee if I've typed python test.py, or python ..\..\test.py.Better to use os.path.dirname(os.path.abspath(__file__)) I think. URL: https://forum.audiogames.net/post/576303/#p576303 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: Require Tolk.py assistance
Re: Require Tolk.py assistance Oh i see. noted but this is still safe to use right?os.add_dll_directory(os.getcwd()) URL: https://forum.audiogames.net/post/576213/#p576213 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: Require Tolk.py assistance
Re: Require Tolk.py assistance Well, for a kick off, what if you're running the code as a script, not from the directory with the DLL in it? It'll not find the DLL anymore.It just feels like a bad idea long term. Also, you probably don't need to do it. If you can already grab the full pat of the module file with __file__, you don't need to set the CWD. URL: https://forum.audiogames.net/post/576043/#p576043 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: Require Tolk.py assistance
Re: Require Tolk.py assistance Will that produce unwanted result eventually? URL: https://forum.audiogames.net/post/576024/#p576024 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: Require Tolk.py assistance
Re: Require Tolk.py assistance I'd be very cautious when changing the CWD. I bet that'll bite you eventually. URL: https://forum.audiogames.net/post/575988/#p575988 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: Require Tolk.py assistance
Re: Require Tolk.py assistance this did it:import sysimport osdir_path = os.path.dirname(os.path.realpath(__file__))os.chdir(dir_path)os.add_dll_directory(os.getcwd())Thanks for your help. URL: https://forum.audiogames.net/post/575869/#p575869 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: Require Tolk.py assistance
Re: Require Tolk.py assistance Hmm... Some mention [here] and [here] seems to suggest that python 3.8 has changed how DLL's are handled and loaded more securely, so they won't load by default from the current working directory anymore. You could try this:import os os.add_dll_directory(os.getcwd()) import Tolk URL: https://forum.audiogames.net/post/575864/#p575864 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: Require Tolk.py assistance
Re: Require Tolk.py assistance It show me the same directory URL: https://forum.audiogames.net/post/575861/#p575861 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: Require Tolk.py assistance
Re: Require Tolk.py assistance Hm, that seems to suggest that your scripts directory and your current working directory are not the same. Try adding this:print(os.getcwd()) URL: https://forum.audiogames.net/post/575857/#p575857 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: Require Tolk.py assistance
Re: Require Tolk.py assistance Ok after i get your zip file @#2, this still happens.D:\Programming\Tolk-Test>py pygame-tolk.pypygame 1.9.6Hello from the pygame community. https://www.pygame.org/contribute.htmlTraceback (most recent call last): File "pygame-tolk.py", line 2, in import Tolk File "D:\Programming\Tolk-Test\Tolk.py", line 19, in _tolk = cdll.Tolk File "C:\Python38\lib\ctypes\__init__.py", line 443, in __getattr__ dll = self._dlltype(name) File "C:\Python38\lib\ctypes\__init__.py", line 373, in __init__ self._handle = _dlopen(self._name, mode)FileNotFoundError: Could not find module 'Tolk' (or one of its dependencies). Try using the full path with constructor syntax. URL: https://forum.audiogames.net/post/575855/#p575855 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: Require Tolk.py assistance
Re: Require Tolk.py assistance Ok will try it. Also i did have Tolk.dll in the same dir. it just wasn't loading for some weird reasonmagurp244 wrote:Tolk.py is a wrapper for Tolk.dll. You'll need the dll in the working directory for the script to function, usually the same directory as the script itself. I'd written an example pack that could help illustrate this which you can find [here]. URL: https://forum.audiogames.net/post/575852/#p575852 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: Require Tolk.py assistance
Re: Require Tolk.py assistance Tolk.py is a wrapper for Tolk.dll. You'll need the dll in the working directory for the script to function, usually the same directory as the script itself. I'd written an example pack that could help illustrate this which you can find [here]. URL: https://forum.audiogames.net/post/575842/#p575842 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: Require Tolk.py assistance
Re: Require Tolk.py assistance Tolk.py is a wrapper for Tolk.dll. You'll need the dll in the same directory for the script to function. I'd written an example pack that could help illustrate this which you can find [here]. URL: https://forum.audiogames.net/post/575842/#p575842 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: Require Tolk.py assistance
Re: Require Tolk.py assistance Tolk.py is a wrapper for Tolk.dll. You'll need the dllin the same directory for the script to function. I'd written an example pack that could help illustrate this which you can find [here]. URL: https://forum.audiogames.net/post/575842/#p575842 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Require Tolk.py assistance
Require Tolk.py assistance So when i try to run a test file to mess around with Tolk.py this error was produced.Traceback (most recent call last): File "test.py", line 7, in import Tolk File "D:\Programming\tolk-master\examples\python\Tolk.py", line 11, in _tolk = cdll.Tolk File "C:\Python38\lib\ctypes\__init__.py", line 443, in __getattr__ dll = self._dlltype(name) File "C:\Python38\lib\ctypes\__init__.py", line 373, in __init__ self._handle = _dlopen(self._name, mode)FileNotFoundError: Could not find module 'Tolk' (or one of its dependencies). Try using the full path with constructor syntax.Here is the code i have.import sysimport osdir_path = os.path.dirname(os.path.realpath(__file__))os.chdir(dir_path)import TolkAnyone know why is this happening? URL: https://forum.audiogames.net/post/575840/#p575840 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector