Re: [PLUG] question about python code on windows vs. linux, hopefully no

Fred Stluka via plug on 5 Feb 2021 12:48:39 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] question about python code on windows vs. linux, hopefully not too off topic


Michael,
Glad to hear it!  I figured it had to be something about the
environment.  Wasn't a library or a driver though?  What was it?
--Fred
------------------------------------------------------------------------
Fred Stluka -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.
------------------------------------------------------------------------
On 2/5/21 3:15 PM, Michael Lazin via plug wrote:
Thanks for the detailed response.  I managed to get it working by making a small environmental change to my work computer.  I have it working now.  Thanks again for your help. On Fri, Feb 5, 2021, 2:53 PM Fred Stluka <fred@bristle.com <mailto:fred@bristle.com>> wrote:
 Michael,
 I worked in Python for about 4 years.  Our team was able to
 confidently assume that all code would behave the same on
 our Mac laptops and our Linux servers.  Never a problem.
 We developed on one and deployed fearlessly on the other
 for 4 years.
 We also used the Django Web framework which includes an ORM
 (Object Relation Mapping) that maps Python objects to relational
 DB tables.  We were able to confidently assume that all code
 would behave with same with MySQL, SQLite, and MS SQL Server.
 We used Django to automatically pull all the data and table defs
 from MS SQL Server and push them to MySQL when migrating
 from an older system.  And we used SQLite (for speed) to run all
 of our automated regression tests as part of our automated build,
 before deploying confidently on MySQL.  Never a problem.
 We had one team member who tried using Windows for a while,
 before I broke down and just bought him a Mac to make our lives
 easier.  On Windows, things worked mostly the same, but we had
 to install different versions of some of the libraries, especially
 drivers for DB access.  And we had all sorts of problems when
 Windows users tried to cut/paste Microsoft-specific non-Unicode
 chars from apps like MS Word and Outlook into the web app.
 Generally speaking, the folks in the on-line support forums were
 VERY friendly and helpful.  See:
 - https://mailman.aps.anl.gov/mailman/listinfo/python-users
 <https://mailman.aps.anl.gov/mailman/listinfo/python-users>
 - https://docs.djangoproject.com/en/dev/internals/mailing-lists/
 <https://docs.djangoproject.com/en/dev/internals/mailing-lists/>
 But they did get a little frustrated with Windows users asking
 about problems that only occurred on Windows.
 Your description is a little vague.  What specific problems are you
 seeing?
 I'm guessing that your problem is caused by differing libraries or
 DB drivers on the 2 computers.  Do you have a good way to take
 a complete inventory of each environment, so you can compare
 them?
 Are you using virtualenv?  It's a VERY lightweight way to set
 up multiple Python environments side-by-side on the same
 computer.  I suggest you use it to create a fresh new Python
 environment on both of your computers.  Doesn't require any
 special privileges.  Any user can do it in their own folder in
 their own home directory.  VERY easy to set up and HIGHLY
 recommended by Python folks for ALL projects.
 As I said to Walt Mankowski on this list a couple years ago.
 > Keep in mind that Python virtual environments are astonishingly
 > lightweight.  Much, much, much simpler than you might expect.
 > I dodged them for a little while, as one more complication that
 > I didn't yet need.  Not true.  Really simple and really useful.  I
 > now use them for EVERY Python project, no matter how small.
 >
 > As I explained to a friend recently...
 >
 > Not like a heavy "virtual machine", VM, that you'd get from
 > VMware, AWS, etc.  That's a whole OS running in a hypervisor.
 >
 > Not like a lighter, but still heavy "container" that you'd get from
 > Docker.  That's a containerized set of files, containing everything
 > except a copy of the OS.
 >
 > A Python "virtual environment" is VERY simple.  A directory, a
 > change to your PATH and to another environment variable or
 > two.  All installs of Python libraries, add-ons, etc., go in the
 > directory tree and the right version of Python and that tree get
 > found via the PATH and env vars.
 >
 > Astoundingly useful and lightweight.  Can have as many
 > different virtualenvs as you like, each in its own folder.  To
 > "uninstall" one, just delete the folder.  Use the generated
 > "virtualenv" (or venv or pyenv) command to create them. It
 > also generates "activate" and "deactivate" scripts (or Windows
 > BAT files) to switch from one virtualenv to another.
 >
 > Here's a page that explains how simple virtualenvs are:
 > -
 https://www.recurse.com/blog/14-there-is-no-magic-virtualenv-edition
 <https://www.recurse.com/blog/14-there-is-no-magic-virtualenv-edition>
 BTW, yes, PyCharm is the best of breed IDE for Python.  MUCH
 better than any other tool for editing, viewing, and debugging
 Python code.  I'm a HUGE fan of FOSS, but PyCharm is one of
 the few proprietary tools that I'm happy to buy and use.
 Good luck!
 --Fred
 ------------------------------------------------------------------------
 Fred Stluka -- http://bristle.com <http://bristle.com> -- Glad to
 be of service!
 Open Source: Without walls and fences, we need no Windows or Gates.
 ------------------------------------------------------------------------
 On 2/5/21 1:56 PM, Michael Lazin via plug wrote:
 > I am trying to do some automation using PyCharm and python on my
 work
 > computer, which runs windows.  I am getting unusual behavior in my
 > code when I run it on my work computer. I run the same code with
 the
 > same libraries installed on PyCharm on my personal computer and the
 > results are different.  Does anyone have a rational explanation for
 > this?  I am new to python programming. I imagine that it is in the
 > realm of possibility that there may be a rational explanation
 for why
 > the same code with the same libraries using similar data sets would
 > have radically different behavior.  I am running Ubuntu Mate
 20.04 on
 > my personal computer.  Any explanation would be appreciated.
 >
 > Thanks,
 >
 > Michael Lazin
 >
 > to gar auto estin noein te kai ennai
 >
 >
 ___________________________________________________________________________
 > Philadelphia Linux Users Group         --
 http://www.phillylinux.org <http://www.phillylinux.org>
 > Announcements -
 http://lists.phillylinux.org/mailman/listinfo/plug-announce
 <http://lists.phillylinux.org/mailman/listinfo/plug-announce>
 > General Discussion  --
 http://lists.phillylinux.org/mailman/listinfo/plug
 <http://lists.phillylinux.org/mailman/listinfo/plug>
___________________________________________________________________________
Philadelphia Linux Users Group -- http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug
___________________________________________________________________________
Philadelphia Linux Users Group -- http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug

AltStyle によって変換されたページ (->オリジナル) /