helppyFormex - Support: sr #109021, .pyc files from external package...

 
 

sr #109021: .pyc files from external package not regenerated

Submitted by:  Tran Phuong Toan <phuotran>
Submitted on:  Tue 26 Apr 2016 01:52:59 PM UTC  
 
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Privacy:  Public
Assigned to:  None Open/Closed:  Open
Operating System:  GNU/Linux

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Thu 28 Apr 2016 08:05:21 AM UTC, comment #2: 

Hi Wouter,

The reload function is indeed working fine, so I'll use it in absence of a better alternative. Thanks for your answer !

Toan

Tran Phuong Toan <phuotran>
Project Member
Wed 27 Apr 2016 08:49:35 AM UTC, comment #1: 

Hi Phuong,

this is because the modules are loaded, and if you call

import module

Python does not reloaded a module if it was already loaded (and pyFormex doesn't unload modules once the script finished).

What I usually do:

import module
reload(module)

Doesn't look nice but it works.

Wouter Devriendt <whdvrien>
Project Member
Tue 26 Apr 2016 01:52:59 PM UTC, original submission:  

Hello,

I have two python files, one for my main pyFormex script (main.py), and another one containing diverse classes (foo.py) with no import related to pyformex. In main.py, I do

import foo

When running main.py with the pyFormex GUI, foo.pyc gets created and the script can access the classes in foo.py. If I make some changes in foo.py and tries to re-run main.py, it seems that pyformex is still running the old version of foo.py. I tried to delete the current foo.pyc, but it is not regenerated when re-running the script with pyformex. The only way I found is to restart the gui, which then regenerates the .pyc file.

Is this an expected behavior ? Is there a way around this ?

I'm using pyformex 1.0.2-a5 on Ubuntu 12.04.

Toan

Tran Phuong Toan <phuotran>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by whdvrien (Posted a comment)
  • -email is unavailable- added by phuotran (Submitted the item)
  • -email is unavailable- added by phuotran
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-04-26 phuotran Carbon-Copy- => Added phuotran

    Back to the top


    Powered by Savane 3.5